第十六章 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角色。

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