Class Reference
%Library.GlobalEdit
Server:irisdocs1
Instance:IRISLATEST
User:UnknownUser
 
-
  [%SYS] >  [%Library] >  [GlobalEdit]
Private  Storage

persistent class %Library.GlobalEdit extends %Persistent, %SYSTEM.Help

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 13 29


Summary

Properties
Collation DatabaseBlockSize Directory Exists
FirstDataBlock GrowthBlock IsEmpty IsKeep
Name Permission PointerBlock ResourceName
System

Methods
%AddToSaveSet %AddToSyncSet %BuildIndices %CheckConstraints
%CheckConstraintsForExtent %ClassIsLatestVersion %ClassName %ComposeOid
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GUID %GUIDSet
%GetLock %GetParameter %GetSwizzleObject %Id
%IsA %IsModified %IsNull %KillExtent
%LockExtent %LockId %New %NormalizeObject
%ObjectIsNull %ObjectModified %Oid %OnBeforeAddToSync
%OnDetermineClass %Open %OpenId %OriginalNamespace
%PackageName %PurgeIndices %Reload %RemoveFromSaveSet
%ResolveConcurrencyConflict %RollBack %Save %SaveDirect
%SerializeObject %SetModified %SortBegin %SortEnd
%SyncObjectIn %SyncTransport %UnlockExtent %UnlockId
%ValidateIndices %ValidateObject CheckGlobalIntegrity CheckIntegrity
CollationPrompt CollationSet Compact CompactGlobal
Create DeleteDirectoryEntry FirstDataBlockGet GetGlobalSize
GetGlobalSizeBySubscript GrowthBlockPrompt GrowthBlockSet Help
IsKeepPrompt IsKeepSet KillRange NameSet
Open PointerBlockPrompt PointerBlockSet


Parameters

• parameter DEFAULTCONCURRENCY = 0;
DEFAULTCONCURRENCY is the default value for the concurrency formal argument defined for %Open, %OpenId, %Delete and %DeleteId methods. It is not the default value of the %Concurrency property of persistent classes. If the value of the actual concurrency argument passed to any of the above methods is -1 then the formal argument value will be set to the value of the DEFAULTCONCURRENCY parameter value defined for the class.

Properties

• property Collation as %Library.Collate;
Collation of the global.
• property DatabaseBlockSize as %Integer(VALUELIST=",2048,4096,8192,16384,32768,65536") [ InitialExpression = $$$8k,ReadOnly ];
Block size of the database the global is in.
• property Directory as %SysPath [ ReadOnly ];
Directory global is located in.
• property Exists as Security.Datatype.BooleanYN [ ReadOnly ];
Global directory entry exists.
• property FirstDataBlock as %Integer [ Calculated ];
First data block of the global.
Note referencing this property causes a $D(global) and I/O to occur.
• property GrowthBlock as %Integer;
Growth block for the global.
• property IsEmpty as Security.Datatype.BooleanYN [ ReadOnly ];
Global contains no data.
• property IsKeep as Security.Datatype.BooleanYN;
Keep global directory attributes when deleted.
• property Name as %String;
Name of the global.
• property Permission as Security.Datatype.Permission [ ReadOnly ];
Current permission on the global. This is the "RW" value that the process who has this instance open has access to it.
• property PointerBlock as %Integer;
Top pointer block of the global.
• property ResourceName as %String [ ReadOnly ];
Resource name of the global.
• property System as %String [ ReadOnly ];
System name where global resides.

Methods

• classmethod CheckGlobalIntegrity(Directory As %String = "", Name As %String, StopAfterAnyError As %Boolean) as %Status
This checks the integrity of a single global. The return value contains information about the global
• method CheckIntegrity(Silent As %Boolean) as %Status
This checks the integrity of a global. The return value contains information about the global
• classmethod CollationPrompt(Prompt, Obj)
• method CollationSet(Arg As %String) as %Status
This is a Set accessor method for the Collation property.
• method Compact(PercentFull As %Integer = 90, ByRef MbProcessed As %Float, ByRef MbCompressed As %Float, MbToCompress As %Integer = 0, ByRef LastGlobalReference As %String = "") as %Status
Compact a global.
PercentFull - How full each data page should be, 50-100
MbProcessed - How many MB of the global was processed
MbCompressed - How many MB was it compressed to
MbToCompress - How many MB of the global to compress in this call (0=ALL)
LastGlobalReference - Last reference, "" = completed

Typical useage is as follows, which compacts the data pages to 80%full, and returns the amount of data processed, and the size it was compacted to:

s x=##Class(%GlobalEdit).Open("X",dbdirectory)
s t=x.Compact(80,.CurrSize,.NewSize)

Note that this function can be called repeatedly for the same global so that it can be done in chunks by using the last two parameters. The following example does 10MB chunks of the global at a time and accumulates and displays a status:

s x=##Class(%GlobalEdit).Open("X",dbdirectory)
s TotalCurrSize=0,TotalNewSize=0
do {
s t=x.Compact(80,.CurrSize,.NewSize,10,.LastReference)
s TotalCurrSize=TotalCurrSize+CurrSize
s TotalNewSize=TotalNewSize+NewSize
w !,"Global "_x.Name_" processed="_TotalCurrSize_", compacted to="_TotalNewSize
} while LastReference'=""
• classmethod CompactGlobal(Name As %String, Directory As %String = {$zu(12, "")}, PercentFull As %Integer = 90, ByRef MbProcessed As %Integer, ByRef MbCompressed As %Integer, MbToCompress As %Integer = 0, ByRef LastGlobalReference As %String = "") as %Status
Compact a global.
See the method Compact for details on parameters.
• classmethod Create(Namespace As %String = "", Name As %String, Collation As %String, GrowthBlock As %Integer, PointerBlock As %Integer, Keep As %Boolean, JournalState As %Integer, ByRef Exists As %Boolean) as %Status
Create a global with specified characteristics. Parameter Namespace can be a namespace or a directory. If it is a namespace global mapping rules will apply.
• classmethod DeleteDirectoryEntry(Directory, Global) as %Status
Delete a directory entry for a global if the global does not exist.
This should be called with Switch 10 set if the global is possibly being accessed by users.

Parameters:
Directory - Directory where the global lives.
Global - Name of the global to delete the directory entry for.
Note: You must have write access to the database to delete the directory entry.
• method FirstDataBlockGet() as %Integer
This is a Get accessor method for the FirstDataBlock property.
• classmethod GetGlobalSize(Directory As %String, GlobalName As %String, ByRef Allocated As %Integer, ByRef Used As %Integer, fast As %Boolean = 0) as %Status
Get size of this global
'Allocated' - total size, in MB, of blocks allocated for the global.
'Used' - total used data, in MB, for the global.
'fast' - TRUE : faster return, it won't return the value of 'Used'.
FALSE - slower return,, it returns values for both 'Allocated' and 'Used'.
• classmethod GetGlobalSizeBySubscript(Directory As %String, StartingNode As %String, EndingNode As %String = "", ByRef Size As %String = 0)
Return the size of a global or range of nodes in a global.
This method will return the size of a global based on the number of database blocks the global resides in.

Parameters:
Directory - Directory where global is located.
StartNode - Staring node of global. Note that you can specify ^GLOBAL(BEGIN) to mean the start of the global. This would include ^GLOBAL itself. You can also specify ^GLOBAL("XXX"_$c(1)_"*next)" to mean start counting after global ^GLOBAL("XXX").
EndNode - End Node of global. The returned sizes do not include the EndNode. Note that you can specify ^GLOBAL(END) to mean through the end of the global. An EndNode value of null, or equal to the value of StartNode will return the size of StartNode and all children of StartNode.
Size - Maximum number of MB to count. If the size of the global exceeds this value, calculation stops, and an error is returned. If undefined or set to 0, then the entire range is counted. Be careful to reset this for multiple calls to the method.
Return Values:
The array Size returns the amount of data in both blocks and MB, for each level of the global, as well as the size of big string data, and a total. If the global does not exist, an error will be returned, and the sizes will all be set to 0. If any other error occurs, sizes will not be set.
Size=Total size in MB of the global range
Size("Blocks","1")=# Blocks in level 1
Size("Blocks","2")=# Blocks in level 2
Size("Blocks","3")=# Blocks in level 3
Size("Blocks","BigStrings")=# Big String Blocks
Size("Blocks","Total")=Total # Blocks in global range
Size("MB","1")=# MB in level 1
Size("MB","2")=# MB in level 2
Size("MB","3")=# MB in level 3
Size("MB","BigStrings")=# Big String MB
Size("MB","Total")=Total # MB in global range

Examples:

Find the size of global ^DATA
s Status=##Class(%GlobalEdit).GetGlobalSizeBySubscript("c:\132u1\mgr\user\","DATA","",.Size)

Find the size of data ^DATA("Jones")
s x=##Class(%GlobalEdit).GetGlobalSizeBySubscript("c:\132u1\mgr\user\","DATA(""Jones"")","",.Size)

Find the size of data between nodes ^DATA("Jones") up to but not including ^DATA("Smith","zzzzz")
s x=##Class(%GlobalEdit).GetGlobalSizeBySubscript("c:\132u1\mgr\user\","DATA(""Jones"")","DATA(""Smith"",""zzzzz"")",.Size)

Find the size of all the data after after node ^X(500)
s x=##Class(%GlobalEdit).GetGlobalSizeBySubscript("c:\db1\","^X(500"_$c(1)_"*next)","^X(END)",.Size)

Find the size of all the data from the beginning of the global up to but not including ^X(500)
s x=##Class(%GlobalEdit).GetGlobalSizeBySubscript("c:\db1\","^X(BEGIN)","^X(500)",.Size)

• classmethod GrowthBlockPrompt(Prompt, Obj)
• method GrowthBlockSet(Arg As %String) as %Status
This is a Set accessor method for the GrowthBlock property.
• classmethod IsKeepPrompt(Prompt, Obj)
• method IsKeepSet(Arg As %Boolean) as %Status
This is a Set accessor method for the IsKeep property.
• classmethod KillRange(Directory As %String, StartingNode As %String, EndingNode As %String) as %Status
Kill a subscripted range of a single global in a single database.
This method will kill a range of globals node of a single global in a single database. The starting and ending global name must be the same. When a range is specified, the global is killed from the starting node up to but not including the ending node. The exception to this is if the starting and ending node is the same then that global is killed. The start and end nodes must not contain namespace specifications. Process private globals are not supported. Note that this method ignores all namespace specifications.
Parameters:
Directory - Location of global to kill.
StartingNode - First node of global range to kill. Note that you can specify ^GLOBAL(BEGIN) to mean the start of the global. This includes the global ^GLOBAL itself You can also specify ^GLOBAL("XXX"_$c(1)_"*next)" to mean start deleting after global ^GLOBAL("XXX").
EndingNode - Ending node of global range to kill, up to, but not including this node. Note that you can specify ^GLOBAL(END) to mean through the end of the global.

Examples:
Kill nodes between ^X(1,5) and ^X(1,50), not including ^X(1,50)
s x=##Class(%GlobalEdit).KillRange("c:\db1\","^X(1,5),"^X(1,50)")

Kill node ^X(500) and all subnodes
s x=##Class(%GlobalEdit).KillRange("c:\db1\","^X(500),"^X(500)")

Kill everything after node ^X(500)
s x=##Class(%GlobalEdit).KillRange("c:\db1\","^X(500"_$c(1)_"*next)","^X(END)")

Kill everything from the beginning of the node up to but not including ^X(500)
s x=##Class(%GlobalEdit).KillRange("c:\db1\","^X(BEGIN)","^X(500)")

• method NameSet(Arg As %String) as %Status
Set the Global name.
If prefaced by a "^" strip it off
• classmethod Open(Name As %String, Directory As %String = {$zu(12, "")}, System As %String = "", concurrency As %Integer = -1, ByRef sc As %Status = $$$OK) as %ObjectHandle
Open an instance of a global.
• classmethod PointerBlockPrompt(Prompt, Obj)
• method PointerBlockSet(Arg As %String) as %Status
This is a Set accessor method for the PointerBlock property.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.