How to get DB and global location information?
I need to write a script to answer a couple of fairly simple questions:
1) What is the current routine DB (name and location) for this namespace?
2) What is the current data DB (name and location) for this namespace?
3) Is global ^ABC mapped to a different location than the default data DB?
Can anyone point me to some system APIs that would allow me to answer these questions?
Thanks!
Ben
Hi,
To get information about a namespace, You may use this code :
(run it only in %sys" namespace)
Properties variable is passed by ref (i.e. it has a point at the beginning)
%SYS>S Status=##Class(Config.Namespaces).Get("user", .Properties)
%SYS>zw Properties
Properties("Globals")="USER"
Properties("Library")="CACHELIB"
Properties("Routines")="USER"
Properties("SysGlobals")="CACHESYS"
Properties("SysRoutines")="CACHESYS"
Properties("TempGlobals")="CACHETEMP"
The GetGlobalDest method of %SYS.Namespace is useful in answering your questions, and it doesn't require a switch to %SYS.
For #1, ask it where ^ROUTINE is mapped to.
For #2, don't specify any global name.
For #3, compare the result for your global with the result for #2.
I previously wrote about this method here:
https://community.intersystems.com/post/how-determine-if-class-mapped-eg...