Question
· Jul 14, 2017

The command to kill all globals given the namespace

Hi,

Is there any COS command could kill all the globals given the namespace?

Thanks.

Discussion (8)1
Log in or sign up to continue

/// Returns a list of the Globals in a Cache NameSpace (used for GUI display)<br>
/// <br>
/// <b>Parameters:</b> <br>
/// NameSpace - a Cache namespace. Default is current namespace. <br>
/// Mask - a mask, or comma-separated list of masks, to select globals. Default is "*" for all.<br>
/// SystemGlobals - boolean flag to include system globals in the results. Default is "0".<br>
/// UnavailableDatabases - a returned local array of any databases not currently accessible, i.e. array(name)=status.<br>
/// Index - Internal use only.<br>
/// IgnoreHasData - For faster list of Globals set this to 1 and the HasData column will always be FALSE.<br>
/// Mapped - Return all mapped global nodes when set to 1, the default value of this parameter is 1.
/// <br>
/// Valid masks are as follows:
/// <br>
/// ABC* - All strings starting with ABC<br>
/// A:D - All strings between A and D<br>
/// A:D,Y* - All strings between A and D, and all strings starting with Y<br>
/// A:D,'C* - All strings between A and D, except those starting with C
Query NameSpaceList(
  NameSpace As %String,
  Mask As %String,
  SystemGlobals As %Boolean,
  ByRef UnavailableDatabases As %String,
  Index As %Integer,
  IgnoreHasData As %Boolean = 0,
  Mapped As %Boolean = 1) As %Query(ROWSPEC = "Name:%String,Location:%String,ResourceName:%String,Permission:%String,Empty:%String,Keep:%String,Collation:%String,PointerBlock:%String,GrowthBlock:%String,HasData:%Boolean,Journal:%String,LockLocation:%String,HasSubscripts:%Boolean") [ SqlProc ]
{
}


set s = ##class(%SQL.Statement).%New()

do s.%PrepareClassQuery("%SYS.GlobalQuery", "NameSpaceList")
set r = s.%Execute("SAMPLE", "*")
set $namespace = "SAMPLE"
while r.%Next() { kill @r.%Get("Name") }