What is the current preferred method for enumerating the globals in a namespace?

孤街浪徒 提交于 2019-12-06 04:17:35

问题


I used to look at the source for %G for this, but lately Intersystems has stopped distributing the .INT code. I guess in theory I could use an eXecute statement in a loop to check $D on every legal global name but that's silly and unreasonably slow.

So what is currently the right way to do it?


回答1:


use special global variable ^$GLOBAL

for example:

s global=""
f { 
s global=$o(^$G(global))
  q:global=""
  zw global
}



回答2:


You could always use the class query in %SYS.GlobalQuery.



来源:https://stackoverflow.com/questions/9793241/what-is-the-current-preferred-method-for-enumerating-the-globals-in-a-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!