第十六章 Caché 变量大全 $SYSTEM 变量 第十六章 Caché 变量大全 $SYSTEM 变量 大纲 描述 标志和限定符 示例

第十六章 Caché 变量大全 $SYSTEM 变量

包含有关系统对象的系统信息。

大纲

$SYSTEM
$SY

$SYSTEM.class.method()

描述

$SYSTEM既可以作为特殊变量调用,也可以作为调用返回系统信息的方法的类调用。

$SYSTEM特殊变量

$SYSTEM作为特殊变量,包含本地系统名称和Caché当前实例的名称,以冒号(:)分隔。机器的名称遵循本地操作系统的大小写约定,并且实例的名称为大写。如果Caché是实例名称的一部分,则最后一个字母没有重音。例如:

DHC-APP>WRITE $SYSTEM,!
LAPTOP-ARLL3DSO:CACHE

还可以使用LocalHostName()方法确定本地系统名称:

DHC-APP>WRITE $SYSTEM.INetInfo.LocalHostName()
LAPTOP-ARLL3DSO

缩写$SY只能作为特殊变量用于$SYSTEM

$SYSTEM Class

$System作为一个类提供对各种系统对象的访问。可以调用返回信息的方法,或者调用执行某些操作(如升级或加载)并返回状态信息的方法。Caché支持多种类型的系统对象,包括:

  • Version:用于Caché及其组件的版本号
  • Sys:对于系统本身
  • OBJ:对于对象
  • SQL:用于SQL查询
  • CSP:用于Caché服务器页面

请注意,对象类名称和方法名称区分大小写。为这些名称指定错误的大小写会导致<class is not exist><method is not exist>错误。如果不在方法名中指定圆括号,则会发出<SYNTAX>错误。

可以使用点语法访问$system方法和属性,如以下等效语法示例所示:

DHC-APP>WRITE ##class(%SYSTEM.INetInfo).LocalHostName()
LAPTOP-ARLL3DSO
DHC-APP>WRITE $SYSTEM.INetInfo.LocalHostName()
LAPTOP-ARLL3DSO

$SYSTEM可以访问%System类包中的系统API类.请注意,在##class语法中,%System类包名称区分大小写。在$SYSTEM语法中,$SYSTEM关键字不区分大小写。

标志和限定符

这些参数可用于控制将外部源导入Caché、编译现有应用程序以及将它们导出到外部目的地。在%SYSTEM的类文档中。OBJ,这些通常作为参数qspec的值提供。每个的可用设置可以通过以下命令显示:

DHC-APP> DO $SYSTEM.OBJ.ShowFlags()
    b - Include sub classes.
    c - Compile. Compile the class definition(s) after loading.
    d - Display. This flag is set by default.
    e - Delete extent.
    h - Generate help.
    i - Validate XML export format against schema on Load.
    k - Keep source.  When this flag is set, source code of
        generated routines will be kept.
    l - Lock classes while compiling.  This flag is set by default.
    p - Percent.  Include classes with names of the form %*.
    r - Recursive.  Compile all the classes that are dependency predecessors.
    s - Process system messages or application messages.
    u - Update only.  Skip compilation of classes that are already up-to-date.
    y - Include classes that are related to the current class in the way that
        they either reference to or are referenced by the current class in SQL usage.
 
These flags are deprecated a, f, g, o, q, v
Default flags for this namespace =dil
You may change the default flags with the SetFlags(flags,system) classmethod.

DHC-APP> DO $SYSTEM.OBJ.ShowQualifiers()
 
           Name: /autoinclude
    Description: Automatically include any classes that are not up to date required to compile this class
           Type: logical
  Default Value: 1
 
           Name: /autoload
    Description: In UnitTest, specifies the directory to be auto-loaded.
           Type: string
 
           Name: /checkschema
    Description: Validate imported XML files against the schema definition.
           Type: logical
           Flag: i
  Default Value: 1
 
           Name: /checksysutd
    Description: Check system classes for up-to-dateness
           Type: logical
  Default Value: 0
 
           Name: /checkuptodate
    Description: Skip classes or expanded classes that are up-to-date.
           Type: enum
      Enum List: none,all,expandedonly,0,1
  Default Value: expandedonly
  Present Value: all
  Negated Value: none
 
           Name: /cleanup
    Description: In UnitTest, if true the unit test will cleanup new globals when it finishes.
           Type: logical
  Default Value: 0
 
           Name: /compile
    Description: Causes classes loaded to be compiled as well.
           Type: logical
           Flag: c
  Default Value: 0
 
           Name: /createdirs
    Description: In Export, determines if to create directories if they do not exist
           Type: logical
  Default Value: 0
 
           Name: /cspcompileclass
    Description: Causes classes created by CSP or CSR load to be compiled. Only effects the CSP/CSR load and not subsequent class compiles.
           Type: logical
  Default Value: 1
 
           Name: /cspdeployclass
    Description: When CSP page loaded deploy the class generated
           Type: logical
  Default Value: 0
 
           Name: /csphidden
    Description: Classes generated from CSP and CSR compilation are marked as hidden.
           Type: logical
  Default Value: 1
 
           Name: /debug
    Description: In UnitTest, /debug causes the Asserts to BREAK if they fail.
           Type: logical
  Default Value: 0
 
           Name: /defaultowner
    Description: When loading classes if the class owner keyword is not defined set the owner to this user, if $username then set it to the current user
           Type: string
 
           Name: /defines
    Description: Comma separated list of macros to define and optionally their values.
           Type: string
 
           Name: /delete
    Description: In UnitTest, determines if loaded classes should be deleted.
           Type: logical
  Default Value: 1
 
           Name: /deleteextent
    Description: Delete extent.
           Type: logical
           Flag: e
  Default Value: 0
 
           Name: /detail
    Description: Show detailed information.
           Type: logical
  Default Value: 0
 
           Name: /diffexport
    Description: Do not include time modified or platform information in export so the files can be run through diff/merge tools.
           Type: logical
  Default Value: 0
 
           Name: /display
    Description: Alias qualifier for /displaylog and displayerror.
           Type: alias
      Enum List: error,log
     Alias List: displayerror,displaylog
  Present Value: all
  Negated Value: none
      All Value: all
     None Value: none
 
           Name: /displayerror
    Description: Display error information.
           Type: logical
           Flag: d
  Default Value: 1
 
           Name: /displaylog
    Description: Display log information
           Type: logical
           Flag: d
  Default Value: 1
 
           Name: /documatichost
    Description: In Export, determines if host that is used in JavaDoc generation
           Type: string
 
           Name: /documaticnamespace
    Description: In Export, determines if namespace that is used in JavaDoc generation
           Type: string
 
           Name: /documaticport
    Description: In Export, determines if port that is used in JavaDoc generation
           Type: string
 
           Name: /expand
    Description: Alias qualifier for /predecessorclasses, /subclasses and /relatedclasses.
           Type: alias
      Enum List: predecessorclasses,subclasses,relatedclasses
     Alias List: predecessorclasses,subclasses,relatedclasses
  Present Value: all
  Negated Value: none
      All Value: all
     None Value: none
 
           Name: /exportgenerated
    Description: When exporting classes also export generated classes where the class generating them is also included
           Type: logical
  Default Value: 0
 
           Name: /exportselectivity
    Description: Export the selectivity values stored in the storage definition for this class
           Type: logical
  Default Value: 1
 
           Name: /exportversion
    Description: In XML export of class the version of Cache the class will be imported into.
           Type: string
 
           Name: /filterin
    Description: Alias qualifier for /application, /system and /percent.
           Type: alias
      Enum List: system,percent,application
     Alias List: system,percent,application
  Present Value: (none)
  Negated Value: (none)
      All Value: all
     None Value: none
 
 
 
           Name: /generated
    Description: When expanding wild cards include generated items (routines/classes/etc)
           Type: logical
  Default Value: 1
 
           Name: /generatemap
    Description: Generate the map file.
           Type: logical
  Default Value: 1
 
           Name: /generationtype
    Description: In Export, determines generation mode
           Type: string
 
           Name: /genserialuid
    Description: In Export, determines if to generate serialVersionUID.
           Type: logical
  Default Value: 1
 
           Name: /hidden
    Description: Show hidden classes.
           Type: logical
           Flag: h
  Default Value: 0
 
           Name: /importselectivity
    Description: If 0 then do not import selectivity values from the XML file. If 1 then import the selectivity values stored in the storage definition when importing XML file. If 2 keep any existing selectivity values but if a property does not have an existing value then use the selectivity from the XML file.
           Type: enum
      Enum List: 0,1,2
  Default Value: 2
  Present Value: 2
  Negated Value: 0
 
           Name: /includesubpackages
    Description: Include sub-packages.
           Type: logical
           Flag: r
  Default Value: 1
 
 
           Name: /javadoc
    Description: In Export, determines if to create javadoc.
           Type: logical
  Default Value: 1
 
           Name: /journal
    Description: Enable journaling of a class compiler
           Type: logical
  Default Value: 1
 
 
           Name: /keepsource
    Description: Keep the source code of generated routines.
           Type: logical
           Flag: k
  Default Value: 0
 
           Name: /load
    Description: In UnitTest, determines if classes should be loaded. If not, then only classnames are obtained from the directories.
           Type: logical
  Default Value: 1
 
           Name: /lock
    Description: Use LOCK command while compiling classes.
           Type: logical
           Flag: l
  Default Value: 1
 
           Name: /make
    Description: In Export, determines if to only generate dependency or class if timestamp of last compilation is greater than timestamp of last generation
           Type: logical
  Default Value: 0
 
           Name: /mapped
    Description: Include classes mapped from another database
           Type: logical
  Default Value: 0
 
           Name: /mergeglobal
    Description: If importing a global from XML file merge the global with existing data
           Type: logical
  Default Value: 0
 
           Name: /multicompile
    Description: Enable use of work queue manager (optionally specify the number of workers if value >1)
           Type: string
 
           Name: /newcollections
    Description: In Export, determines if to use native Java collections.
           Type: logical
  Default Value: 1
 
 
           Name: /percent
    Description: Include percent classes.
           Type: logical
           Flag: p
  Default Value: 0
 
           Name: /pojo
    Description: In Export, determines if POJO generation mode
           Type: logical
  Default Value: 0
 
           Name: /predecessorclasses
    Description: Recursively include dependency predecessor classes.
           Type: logical
           Flag: r
  Default Value: 0
 
           Name: /primitivedatatypes
    Description: In Export, determines if to use Java primitives for %Integer, %Boolean, %BigInt, %Float .
           Type: logical
  Default Value: 0
 
           Name: /projectabstractstream
    Description: In Export, determines if to project classes that contain methods whose arguments are abstract streams or whose return type is an abstract stream.
           Type: logical
  Default Value: 0
 
           Name: /projectbyrefmethodstopojo
    Description: In Export, determines if to project byref methods to pojo implementation.
           Type: logical
  Default Value: 0
 
           Name: /recursive
    Description: Determines if Export classes recursively, or if UnitTest tests in subdirectories should run recursively.
           Type: logical
           Flag: r
  Default Value: 1
 
           Name: /relatedclasses
    Description: Recursively include related classes.
           Type: logical
           Flag: y
  Default Value: 0
 
           Name: /run
    Description: In UnitTest, determines if tests should run
           Type: logical
  Default Value: 1
 
           Name: /skipstorage
    Description: In class Export, if true do not export storage definition.
           Type: logical
  Default Value: 0
 
 
           Name: /subclasses
    Description: Recursively include sub-classes.
           Type: logical
           Flag: b
  Default Value: 0
 
           Name: /system
    Description: Process system messages or application messages.
           Type: logical
           Flag: s
  Default Value: 0
 
           Name: /unconditionallyproject
    Description: In Export, determines if to project regardless of problems that may prevent code from compiling or working correctly.
           Type: logical
  Default Value: 0
 
           Name: /unicode
    Description: Export UNICODE files.
           Type: logical
           Flag: n
  Default Value: 0
 
           Name: /usedeepestbase
    Description: In Export, determines if to use deepest base in which method or property is defined for method or property definition.  If P is defined in A,B, and C and A extends B extends C then C is a deeper base for P.
           Type: logical
  Default Value: 0
 
No Default Qualifiers at system level are set.
No Default Qualifiers for namespaces are set

Flags

在这两个中,Flags是较早的。它们是根据UNIX®命令行参数建模的,因此是一个或两个字符的序列。现有标志及其含义(不建议使用的标志除外)为:

现有标志:

标志 含义 默认
b 包括在SQL使用中引用当前类的子类和类。
c 加载后编译类定义。
d 显示。默认情况下设置标志。 X
e 删除描述扩展区使用的全局存储的扩展区定义,并删除数据。
h 显示隐藏类。
i 根据加载时的架构验证XML导出格式。默认情况下设置标志。 X
k 保持消息来源。设置此标志时,将保留生成的例程的源代码。
l 编译时锁定类。默认情况下设置标志。 X
p 包括名称以“%”字符开头的类。
r 递归。编译作为依赖项前置的所有类。
s 系统。处理系统消息或应用程序消息。
y 包括与当前类相关的类;在SQL使用中引用当前类或在SQL使用中被当前类引用的类。
o1, o2, o3, o4 优化说明符。类编译器已弃用和忽略。

注意:可以通过在标志前面加破折号(-)来关闭标志。

Qualifiers

在开发Caché5.1版的过程中,很明显,Flags显然不足以满足新出现的导入、导出和编译需求。没有取代标志机制,而是实现了一组更新、更具可扩展性的控件:限定符。为了保持向后兼容性,标志机制仍然完全受支持。此外,还存在一个限定符,其含义与每个现有标志相同,并且这两个限定符可以在同一说明符中使用。

由于有更多的限定符,它们根据它们所控制的功能被组织成组,如下表所示。不推荐使用的限定符未显示。

也可以使用SetQualifiers()方法为当前命名空间(默认)或系统范围设置这些限定符。

编译器限定符

标志 含义 默认
/autoinclude 自动包含编译此类所需的任何非最新类。 1
/checkschema 自动包含编译此类所需的任何非最新类根据模式定义验证导入的XML文件.. 1
/checksysutd 检查系统类是否是最新的。 0
/checkuptodate 跳过最新的类或扩展类。 expandedonly
/compile 也会导致加载的类被编译。 0
/cspcompileclass 导致由CSP或CSR加载创建的类被编译。 1
/cspdeployclass 加载CSP页面时,部署生成的类。 0
/csphidden 从CSP和CSR编译生成的类被标记为隐藏。 1
/defaultowner 加载类时,如果未定义所有者关键字,则将此字符串中指定的用户名作为类所有者插入类定义中。如果该字符串的值是$USERNAME,则将当前用户名作为类所有者插入到类定义中。
/defines 要定义的以逗号分隔的宏列表,以及可选的宏值。
/deleteextent 删除描述该范围使用的全局存储的范围定义,并删除数据。 0
/diffexport 导出时不包含任何时间或平台信息,因此文件可以通过不同/合并工具运行。 0
/display /displaylog和/displayerror的别名限定符。
/displayerror 显示错误信息。 1
/displaylog 显示日志信息。 1
/expand /predecessor class、/subclass和/related class的别名限定符。
/exportgenerated 当导出类时,也导出生成的类,其中生成它们的类也包括在内。 0
/exportselectivity 导出存储在此类存储定义中的选择性值。 1
/filterin /application、/system和/percent的别名限定符。
/generated 确定扩展包中的模式或类列表时是否包括生成的项(例程、类等)。). 1
/generatemap 生成地图文件。 1
/importselectivity 0:不要从XML文件中导入选择性值。1:导入XML文件时,导入存储定义中存储的选择性值。2:保留现有的类选择性值,但是如果现有的类没有为XML文件中存在的东西指定选择性,则使用XML文件中的选择性值。 2
/includesubpackages 包括子包. 1
/journal 执行类编译时启用日记。如果执行编译的进程专门禁用了日志记录,则/Journal默认为0,而不是系统范围的默认值1。 1
/keepsource 保留生成的例程的源代码。 0
/lock 编译类时使用LOCK命令。 1
/mapped 包括从另一个数据库映射的类。如果特别要求从另一个数据库(CompileList()方法)编译一个类,则无论/MAPPED设置如何,该类都将被编译。/MAP仅在代码搜索类时才适用,例如,使用CompileAll()方法。 0
/mergeglobal 如果从XML文件导入全局,则会将全局与现有数据合并。 0
/multicompile 使多个用户JOB能够编译类。 1
/percent 包括百分比类。 0
/predecessorclasses 递归地包括依赖项前导类。 0
/relatedclasses 递归地包括相关类。 0
/retainstorage 编译类时,编译器会生成存储定义。默认情况下,如果更新存储定义,则类定义将使用更新后的存储定义进行更新。如果类的新版本是从外部源加载的,则更新后的存储定义将被类定义的新版本中定义的任何内容覆盖。如果类的新版本不包括存储定义,则删除现有存储定义。设置/保留存储临时保存现有存储定义,并在加载类的新版本后恢复它。如果类的新版本还定义了存储定义,则现有存储定义将被覆盖,而不会保留。如果类的新版本没有定义存储定义,则还原以前版本的存储定义。 0
/subclasses 递归地包括子类。 0
/system 处理系统消息或应用程序消息。 0

导出限定符

标志 含义 默认
/checksysutd 检查系统类的最新情况。 0
/checkuptodate 映射时检查类是否为最新的。 expandedonly
/createdirs 如果目录不存在,则创建这些目录。 0
/cspdeployclass 当CSP页面加载时部署生成的类。 0
/diffexport 在导出中不包含任何时间或平台信息,因此可以通过比较/合并工具运行文件。 0
/display /displaylog和/displayerror的别名限定符。
/displayerror 显示错误信息。 1
/displaylog 显示日志信息。 1
/documatichost JavaDoc生成中使用的主机。
/documaticnamespace JavaDoc生成中使用的命名空间。
/documaticport JavaDoc生成中使用的端口。
/exportgenerated 在导出类时,还会导出生成的类,其中也包括生成它们的类。 0
/exportselectivity 为此类导出存储定义中存储的选择值。 1
/exportversion 指定目标Caché版本以将此导出作为三部分发行版本进行加载,例如2012.2.2。Caché使用/ exportversion值通过删除早期Caché版本中未实现的类关键字来处理跨Caché版本的导出格式更改。指定/ exportversion不能保证导出和导入系统之间代码的兼容性。 当前版本的Caché
/generatemap 生成地图文件。 1
/generationtype 生成方式。
/genserialuid 生成serialVersionUID。 1
/importselectivity 0:不从XML文件导入选择值; 1:导入XML文件时,导入存储在存储定义中的选择性值; 2:保留所有现有的选择性值,但是如果属性不具有现有值,则使用XML文件中的选择性。 2
/includesubpackages 包括子软件包。 1
/javadoc 不创建javadoc。 1
/make 仅当上次编译的时间戳大于上一代的时间戳时才生成依赖项或类。 0
/mapped 包括从另一个数据库映射的类。 0
/mergeglobal 如果从XML文件导入全局文件,则会将该全局文件与现有数据合并。 0
/newcollections 使用本地Java集合。 1
/percent 包括百分比类。 0
/pojo POJO生成模式。 0
/predecessorclasses 递归包括依赖关系的前身类。 0
/primitivedatatypes 将Java原语用于%Integer,%Boolean,%BigInt,%Decimal。 0
/projectabstractstream 项目类包含的方法的参数为抽象流,或者其返回类型为抽象流。 0
/projectbyrefmethodstopojo 将byref方法投影到pojo实现中。 0
/recursive 递归导出类。 1
/relatedclasses 递归包括相关类。 0
/skipstorage 不导出类存储信息。 0
/subclasses 递归包括子类。 0
/system 处理系统消息或应用程序消息。 0
/unconditionallyproject 进行项目分析,而不考虑可能导致代码无法编译或无法正常工作的问题。 0
/usedeepestbase 使用为方法或属性定义定义方法或属性的最深层基础。如果在A,B中定义了P,并且C和A扩展了B扩展了C,那么C是P的更深基础。 0

ShowClassAndObject限定词

标志 含义 默认
/detail 显示详细信息。 0
/diffexport 在导出中不包含任何时间或平台信息,因此可以通过差异/合并工具运行文件。 0
/hidden 显示隐藏的类。 0
/system 处理系统消息或应用程序消息。 0

UnitTest

标志 含义 默认
/autoload 指定要自动加载的目录。
/cleanup 完成单元测试后清理全局变量。默认情况下,不清除全局变量。即使设置了DeepSee全局变量,也不会对其进行清理。 0
/debug 导致断言在失败时中断。 0
/delete 确定是否应删除加载的类。 1
/display /displaylog和/displayerror的别名限定符。
/displayerror 显示错误信息。 1
/displaylog 显示日志信息。 1
/findleakedvariables 启用后,进程中当前设置的公共变量将在测试运行之前记录,然后与测试完成后设置的公共变量进行比较。除了一组预先确定的已知上下文和输出变量(如SQLCODE)之外,任何新定义的变量及其值都会报告为测试失败。 0
/load 确定是否应该加载类;如果不加载,则只从目录中获取类名。 1
/loadudl 加载由Atelier生成的UDL文件。设置后,加载.cls、.mac、.int和.inc文件。/loadudl和/loadxml可用于限制加载的文件类型;默认情况下,加载所有文件。UDL文件始终加载为UTF8,以便正确加载Unicode字符。 1
/loadxml 加载Studio生成的XML文件。设置后,加载.xml文件。/loadudl和/loadxml可用于限制加载的文件类型;默认情况下,加载所有文件。 1。 /RECURSIVE 确定子目录中的测试是否应该递归运行。 1
/run 确定是否应运行测试。 1

这些限定符在qspec中以它们出现的形式给出,例如,“/Compile/displayerror/subclass”。限定符之间不允许有空格。

注意:可以通过在限定符前面加上“no”来否定限定符,如“/nodisplaylog”。或者,限定符的值可以显式指定为“/displaylog=0”。

Flag的限定符。

下表给出了现有标志和等效限定符。一些标志映射到多个限定符,并且在用于不同目的时也有不同的含义。

Flag限定符映射

标志 限定符 默认
b Compiler /subclasses 0
c Compiler /compile 0
d Compiler /displayerror 1
d Compiler /displaylog 1
d UnitTest /displayerror 1
d UnitTest /displaylog 1
e Compiler /deleteextent 0
i Compiler /checkschema 1
k Compiler /keepsource 0
l Compiler /lock 1
p Compiler /percent 0
r Compiler /predecessorclasses 0
r Compiler /includesubpackages 1
s Compiler /system 0
y Compiler /relatedclasses 0
b Export /subclasses 0
d Export /displayerror 1
d Export /displaylog 1
g Export /exportselectivity 0
p Export /percent 0
r Export /includesubpackages 1
r Export /recursive 1
r Export /predecessorclasses 0
s Export /system 0
y Export /relatedclasses 0
h ShowClassAndObject /hidden 0
s ShowClassAndObject /system 0

处理顺序

从左到右处理qspec。给定标志或限定符的设置将覆盖当前设置,无论它来自环境默认值还是来自qspec中较早的事件。

当标志和限定符同时出现时,标志必须放在限定符之前(左侧)。这意味着限定符设置始终会覆盖所有标志设置。

示例

以下是使用$SYSTEM调用返回系统信息的方法的示例:

DHC-APP>WRITE $SYSTEM.OBJ.Version()
Cache Objects Version 2016.2.0.736

请注意,此对象版本的格式与$ZVERSION特殊变量中包含的系统版本号的格式不同。

可以如下列出OBJ类的所有方法。 (通过更改类名称,可以使用此方法获取任何系统类的列表):

DHC-APP>DO $SYSTEM.OBJ.Help()
'Do $system.OBJ.Help(method)' 将显示单个方法的完整描述.
 
类的方法:%SYSTEM.OBJ
 
CloseObjects()
     Deprecated function, to close objects let them go out of scope.
 
Compile(&classes,qspec,&errorlog,recurse)
     Compile a class.
 
CompileAll(qspec,&errorlog)
     Compile all classes within this namespace.
 
CompileAllNamespaces(qspec,&errorlog)
     Invoke $system.OBJ.CompileAll for all the namespaces.
 
CompileInfoClass(class,*version,*compiletime)
     Given a <var>class</var> this returns the <var>version</var> of Cache this was compiled on and the <var>compiletime</var> of this class.
 
CompileList(&list,qspec,&errorlog,&updatedlist)
     Compile a list of items specified in 'list' and separated by commas, or an array list("item.MAC")="" or wild cards.
 
CompilePackage(package,qspec,&errorlog)
     Compile all classes within the specified package.
 
CompileProject(project,qspec,&errorlog)
     Compile all entries in this project.
 
Delete(&classes,qspec,&errorlog)
     Delete a class.
 
DeleteAll(qspec)
     Delete all the classes in this namespace.
 
DeletePackage(package,qspec)
     Delete all the classes within the specified package.
 
DeleteProject(project,qspec)
     Delete the named project from this namespace.
 
DisplayError(err)
     Decode and display an object error message to the console.
 
Dump(oref)
     Dump an object to the console.
 
Export(&items,&filename,qspec,&errorlog,Charset)
     Export items as an XML file
 
ExportAllClasses(&filename,qspec,&errorlog,Charset)
     Export all the classes in this namespace as one large XML file.
 
ExportAllClassesIndividual(dirname,qspec,&errorlog,Charset,Package,SubDir)
     Export all the classes as individual XML files to a directory.
 
ExportAllClassesToStream(&stream,qspec,&errorlog,Charset)
     Export all the classes in this namespace to a stream.
 
ExportCPP(classname,dirname,qspec,&errorlog)
     Export a class to C++ files.
 
ExportJava(classname,dirname,qspec,&errorlog,&paths="",&Seen)
     Export a class to a Java file.
 
ExportJavaPackage(Package,dirname,qspec,&errorlog,&paths="")
     Export classes in this package to Java.
 
ExportODL(classname,filename,qspec,&errorlog)
     Export a class to ODL file.
 
ExportPackage(package,&filename,qspec,&errorlog,Charset)
     Export a set of classes in a package as an XML file.
 
ExportPackageToStream(package,&stream,qspec,&errorlog,Charset)
     Export a set of classes in a package in XML format to a stream.
 
ExportPattern(pattern,&filename,qspec,&errorlog,Charset)
     Export all items matching a pattern to an XML file
 
ExportPatternToStream(pattern,&stream,qspec,&errorlog,Charset)
     Export all items matching a pattern in XML format to a stream
 
ExportToStream(items,&stream,qspec,&errorlog,Charset)
     Export items in XML format to a stream
 
ExportUDL(itemname,filename,qspec,&errorlog,Charset)
     Export a class or routine in UDL format.
 
GetClassList(&items,qspec)
     Return an array of classes in this namespace.
 
GetConcurrencyMode()
     Return the current Object Concurrency mode.
 
GetDependencies(&class,*included,qspec)
     This will return a list of classes the class compiler will include if the listed classes are compiled.
 
GetPackageList(&items,package,qspec)
     Return an array of classes in this package.
 
GetQualifiers(system)
     Get the default qualifiers for this namespace or this system.
 
GetTransactionMode()
     Return the current Object transaction mode.
 
Help(method)
     Write out a list of the methods of this object to the console.
 
ImportDir(dir,wildcards,qspec,&errorlog,recurse,&imported,listonly,&selectedlist)
     Import and optionally compile all items in a directory.
 
IsUpToDate(class,log,type)
     Return if this <var>class</var> is up to date or not.
 
IsValidClassname(class)
     Return $$OK if this class name is valid, or an error message if it is not.
 
Load(file,qspec,&errorlog,&loadedlist,listonly,selecteditems,displayname,charset,&description)
     Load a file from disk into Cache.
 
LoadDir(dir,qspec,&errorlog,recurse,&loadedlist)
     Load all class definitions in a directory.
 
LoadLanguage(language,qspec)
     Import the system messages for the specified language from ...\mgr\Locale\allmessages_[language].xml
 
LoadStream(stream,qspec,&errorlog,&loadedlist,listonly,selecteditems,displayname,charset)
     Load a stream into Cache.
 
MakeClassDeployed(&classes,qspec,fulldeploy)
     Make a class or classes deployed.
 
New(ClassName)
     Create a new object instance.
 
Open(ClassName,oid)
     Open a persistent object instance.
 
OpenId(ClassName,id)
     Open a persistent object instance.
 
RedirectBindSrvUserOutput(val)
     Turn output redirection on and off in the binding server.
 
SaveObjects()
     Save all instances of %Library.Persistent in the process. Returns a status value.
 
SetConcurrencyMode(value,&pStatus)
     Set the Object concurrency mode for the current process to a new value.
 
SetFlags(flags,system)
     Set the default flags for this namespace or this system.
 
SetQualifiers(qspec,system,group)
     Set the default qualifiers for this namespace or this system.
 
SetTransactionMode(value,&pStatus)
     Set the object transaction mode for the current process to a new value.
 
ShowClasses(qspec)
     Write all classes defined in this namespace to the console.
 
ShowFlags()
     Display the list of flags used by the compiler.
 
ShowMacros()
     Display the list of supported macros defined in the system.
 
ShowObjects(qspec)
     Write all object instances in this process to the console.
 
ShowQualifiers(group)
     Display the list of qualifiers defined in the system.
 
ShowReferences(oref,chkObj)
     Display a list of all variables that contain a reference to this <var>oref</var>.
 
UnCompile(&classes,qspec)
     Uncompile a class or classes.
 
UpdateConfigParam(classname,parameter,value)
     Allows updating a CONFIGVALUE parameter type.
 
Upgrade(qspec,&errorlog)
     Upgrade the class definition database in one namespace.
 
UpgradeAll(qspec,&errorlog)
     Upgrade the class definition database in all the namespaces.
 
ValidateIndices(classname,idxList,autoCorrect,lockOption)
     Validate indices for a class
 
Version()
     Return the version number of the current object library.

要仅列出类中一个方法的信息,请在“帮助”参数列表中指定方法名称,如以下示例所示:

DHC-APP>DO $SYSTEM.OBJ.Help("Load")
method:class的描述 Load:%SYSTEM.OBJ
 
Load(file:%String="",qspec:%String="",&errorlog:%String,&loadedlist:%String,listonly:%Boolean,selecteditems:%String,displayname:%String,charset:%String="",&description:%String)
Load a file from disk into Cache.
<p>Load, and optionally compile (if 'c' flag is present), class definitions, CSP pages, routines, or globals from the
file <var>file</var>. <var>file</var> may be a list of files to load separated with '*' symbols.<br>
You can import files exported in XML format, %RO format, CDL format, UDL format, and CSR/CSP files.<br>
A comma separated list of the items it loaded is returned in <var>loadedlist</var>. If the list is too long to fit
in the variable, it is terminated with '...'. Items loaded are always returned as subscripts of the <var>loadedlist</var> array.<br>
If you pass <var>listonly</var> as true then it will not
import anything but just list the items that exist in <var>file</var>.<br>
If <var>selecteditems</var> is defined then this will contain either a comma separated list
of items to import or a single subscripted array. It will only import items that are in this list from the file
provided, so this provides a way to limit which items get imported.<br>
<var>qspec</var> is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()'
and 'Do $system.OBJ.ShowFlags()'.<br>
When loading a %RO file the <var>description</var> variable will be filled in
with the description from the %RO file if there is one present.<br>
<var>errorlog</var> is an array of the  <class>%Status</class> return
values from this call, in the format returned by $system.Status.DecomposeStatus.<br>
The <var>displayname</var> is normally not provided. If present
it changes the 'load file XYZ' name from the filename to the displayname. This is useful when loading a stream where the
stream filename is not the name of the file the user knows from a client system and we want to present a meaningful name.<br>
If the filename ends in .gzip or .gz then we ungzip this file before loading it.

以下是$SYSTEM调用方法的更多示例:

/// d ##class(PHA.TEST.SpecialVariables).SYSTEM()
ClassMethod SYSTEM()
{
    DO $SYSTEM.OBJ.Upgrade()
    WRITE !,"* * * * * * * * * * * "
    DO $SYSTEM.CSP.DisplayConfig()
    WRITE !,"* * * * * * * * * * * "
    WRITE !,$SYSTEM.Version.GetPlatform()
    WRITE !,"* * * * * * * * * * * "
    WRITE !,$SYSTEM.SYS.TimeStamp()
}
DHC-APP>d ##class(PHA.TEST.SpecialVariables).SYSTEM()
 
No classes were modified.
 
* * * * * * * * * * *
CSP Global Configuration parameters
-----------------------------------
 
DebugErrorPage:0
If true then when there is an error on the error page it will display the
default CSP error page. This can help in debugging the error page, however
the default behavior is to log the error in ^%ETN and display a criptic
message that something has gone wrong. This is more secure for a live site.
 
DefaultErrorPage:
If defined this is the default error page to use when no application error
page is defined. This applies if the user references an application that
does not exist, or an error occurs in an application that does not have
an error page setup
 
ClearSessionsOnRestart:1
If true this will clear all the session data in ^%cspSession on a
Cache system restart. This means that a user can not continue their
CSP session after the restart, it also means that no licenses are
taken out for these restarted sessions
 
SessionLockTimeout:240
Number of seconds to wait to obtain a lock on the session object
if it still can not obtain a lock in this period of time it will
not be able to open the session object.
 
Expire:366
Number of days to keep the CSP performance data for before being
removed.
 
DefaultServerName:
In CSP we support virtual servers, so a request for /csp/samples/menu.csp
from web server 'X' can be dispatched to a different namespace than the
same request from web server 'Y'. If this DefaultServerName is defined this
is the web server name to default to if none is specified in the url.
 
CSPConfigName:cache
Machine configuration name used by CSP. This defaults to the system
config name unless manually set. CSP urls can be prefixed by this configuration
name to allow one web server to talk to multiple Cache instance
 
DefaultLoginPage:%CSP.Login.cls
System default login page if no login page is specified for this application
 
DefaultPasswordChangePage:%CSP.PasswordChange.cls
System default password change page if no password change page is specified
for this application
 
OptionalBrokerJS:0
If true, suppress the loading of cspBroker.js in the case of HyperEvents
which use XMLHttpRequest.
 
FileServerPage:%CSP.StreamServer.cls
The class to call to serve up static files from this Cache server. The
url of the page is passed in as the 'FILE' parameter
 
8BitLocaleCharset:0
If 0 (false) use utf-8 on 8bit Cache installs as default response charset.
If 1 (true) use the 8bit default locale as the response charset.
 
ProtectSessionCallback:1
If 0 (false) do not use exclusive new to protect session callback methods so variable set in here can be seen in the page.
If 1 (true) use an exclusive new in session callbacks to avoid leaking variables, this is the default.
 
DisableGatewayCacheClear:0
If 0 (false) when we update static files we will ask the CSP gateway to clear any cache it has for this file.
If 1 (true) all automatic updates to the CSP gateway to remove items from the cache are disabled.
 
SessionPersistentHeaders""
List of HTTP headers we wish to initialize all sessions with. The format of this is
$lb($lb(name1,value1),$lb(name2,value2),...)
 
 
* * * * * * * * * * *
x86-64
* * * * * * * * * * *
65770,18917.702

下面的示例使用##class(%SYSTEM)语法形式调用与上一示例相同的方法:

   DO ##class(%SYSTEM.OBJ).Upgrade()
   DO ##class(%SYSTEM.CSP).DisplayConfig()
   WRITE !,##class(%SYSTEM.Version).GetPlatform()
   WRITE !,##class(%SYSTEM.SYS).TimeStamp()

前两个示例要求UnknownUser已分配%DB_CACHESYS角色。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章