文章
· 三月 5, 2021 阅读大约需 2 分钟

通过 SQL SELECT 显示 Global

这是一个第三方写的在 IRIS 2020.1 和 Caché 2018.1.3 上工作的代码示例
不会与新版本保持同步
也不会获得 InterSystems 支持提供的服务!     

Caché/Ensemble/IRIS 中的 Global 通常在 SQL 访问中是不可见的  
本示例将展示如何克服此限制。
Global 将呈现为一个表,其中包含它们的下标和存储的内容。  
要查看的 global 通过一个静态 WHERE 条件传递给 SQL,  
该条件需要 3 个参数:

  • 名称 (必需)
  • 开始下标 (可选)
  • 结束下标 (可选)

只提供 global 名称将获得整个 global 的导出数据。
还可以为 global 提供扩展引用,并且由于这是 SQL 表,因此各种附加条件都适用。

小心, 在 SQL 和 Caché/Ensemble/IRIS 之间进行正确引用可能是一个挑战。

示例:
select * from zrcc_G.dump where zrcc_G.Dump('^|"CACHE"|Sample.PersonD',2,4)=1

ID	       Global	        Subscript	      Value
1	^|"CACHE"|Sample.PersonD	(2)	$lb("",792533244,"GlobaDynamics Holdings Inc.",64256,"C1787","Y5365","A5","A658","R1770","","Ironhorse,Alice D.","T3710","O3","I4011","W8367","557-37-6758",83059958205089661,"1841-01-02 00:00:00")
2	^|"CACHE"|Sample.PersonD	(3)	$lb("",862705606,"TeleLateral Associates",34553,"V8155","T8918","X9","V8732","K1167","","Eisenstien,Peter E.","H208","C8","Q2015","Q3357","702-46-8467",57275722714358892,"2020-06-23 13:27:18")
3	^|"CACHE"|Sample.PersonD	(4)	$lb("",677194559,"RoboSoft Group Ltd.",52738,"F4851","Z364","S8","O6888","O4367","","Eagleman,Clint C.","C8051","R6","V1659","C9814","664-33-8809",-53705244349891319,"2020-06-23 13:27:18")

select TOP 15 * from zrcc_G.dump where zrcc_G.Dump('^%SYS','"JOURNAL"')=1

ID	Global	       Subscript	         Value
1	^%SYS	("JOURNAL")	           0
2	^%SYS	("JOURNAL","ALTDIR")   "C:\InterSystems\IRIS\altjournal\"
3	^%SYS	("JOURNAL","CURDIR")   "C:\InterSystems\IRIS\mgr\journal\"
4	^%SYS	("JOURNAL","CURRENT")  "1^C:\InterSystems\IRIS\mgr\journal\20200801.009"
5	^%SYS	("JOURNAL","EXPSIZE")  0
6	^%SYS	("JOURNAL","LAST")     "1^C:\InterSystems\IRIS\mgr\journal\20200801.009"
7	^%SYS	("JOURNAL","LIFESPAN","FILE")	"2,2"
8	^%SYS	("JOURNAL","MAXSIZE")	 1073741824
9	^%SYS	("JOURNAL","PREFIX")   ""
10	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191104.001")	"2019-11-07 17:38:30"
11	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191104.002")	"2019-11-07 17:38:30"
12	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191104.003")	"2019-11-07 17:38:30"
13	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191104.004")	"2019-11-07 17:38:30"
14	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191104.005")	"2019-11-08 08:39:47"
15	^%SYS	("JOURNAL","PURGED","c:\intersystems\iris\mgr\journal\20191105.001")	"2019-11-08 08:39:47"
讨论 (1)1
登录或注册以继续