Question
· Dec 25, 2023

Access to a Global like ^name over odbc?

Dear Community,

i need help to access to a Global like ^name over ODBC (SQL)
i will visit this global in a loop from a php site. It a access over SQL or ODBC possible?

 

Thanks for help and marry Christmas

Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2022.1 (Build 209U)
Discussion (6)2
Log in or sign up to continue

Hi,

You need use Persistent class.
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

Community article.
https://community.intersystems.com/post/art-mapping-globals-classes-1-3

Like this.(Display ^Hban global on Dbeaver what used SQL.)

Class Gbl.Hban Extends %Persistent [ SqlRowIdPrivate, StorageStrategy = MyGlobalStorage ]
{

/// Index
Index KeyIndex On (year, key) [ IdKey, Unique ];

/// first key
Property year As %Integer [ Required, SqlColumnNumber = 2 ];

/// second key
Property key As %String [ Required, SqlColumnNumber = 3 ];

/// third key
Property data As %String;

Storage MyGlobalStorage
{
<Description>
<![CDATA[]]></Description>
<SQLMap name="GblMap">
<Data name="data">
<Delimiter>"^"</Delimiter>
<Piece>1</Piece>
</Data>
<Global>^Hban</Global>
<RowIdSpec name="1">
<Expression>{L1}</Expression>
<Field>year</Field>
</RowIdSpec>
<RowIdSpec name="2">
<Expression>{L2}</Expression>
<Field>key</Field>
</RowIdSpec>
<Subscript name="1">
<Expression>{year}</Expression>
</Subscript>
<Subscript name="2">
<Expression>{key}</Expression>
</Subscript>
<Type>data</Type>
</SQLMap>
<StreamLocation>^Gbl.TestS</StreamLocation>
<Type>%Storage.SQL</Type>
}

}

It is still in IPM. OEX seems to have lost it.  ???
 

zpm:USER>search global-dump-sql
registry https://pm.community.intersystems.com:
global-dump-sql 1.0.2
zpm:USER>install global-dump-sql
 
[USER|global-dump-sql]  Reload START (C:\InterSystems\IRIS\mgr\.modules\USER\global-dump-sql\1.0.2\)
[USER|global-dump-sql]  Reload SUCCESS
[global-dump-sql]       Module object refreshed.
[USER|global-dump-sql]  Validate START
[USER|global-dump-sql]  Validate SUCCESS
[USER|global-dump-sql]  Compile START
[USER|global-dump-sql]  Compile SUCCESS
[USER|global-dump-sql]  Activate START
[USER|global-dump-sql]  Configure START
[USER|global-dump-sql]  Configure SUCCESS
[USER|global-dump-sql]  Activate SUCCESS
 
Just providing the global name results in a full global dump.
Example:
USER>zn "user"
IRISAPP>d $system.SQL.Shell()
SQL Command Line Shell
... select TOP 5 * from zrcc_G.dump where zrcc_G.Dump('^%SYS','"JOURNAL"')=1