Hi
I have created a DB example exploring structured variables:
⍝ setting the connect parameters
MY_DB.DB_CONNECT.DB_NAME←'db_name'
MY_DB.DB_CONNECT.DB_HOST←'172.0.0.1'
MY_DB.DB_CONNECT.DB_USER←'me'
MY_DB.DB_CONNECT.DB_PASSWD←'t0tal53(rt'
⍝ Do the connect. Use root name only.
BD_CONNECT.DB_HNDL←SQL_CON BD_CONNECT
[0] H← *SQL_CON* C; ∆SQL; q; c; con_str
[1] q←"'" ⋄ c←"', '"
[2] ∆SQL←'' ⍝ testing only. Replace ∆SQL by SQL to execute the command.
[3] con_str ← ∊'CONNECT(' q C.DB_NAME c C.DB_HOST c C.DB_USER c
C.DB_PASSWD q ')'
[4] H←∆SQL con_str
∇
⍝ test internals
*SQL_CON* MY_DB.BD_CONNECT
CONNECT('db_name', '172.0.0.1', 'me', 't0tal53(rt')
⍝ my be ....
MY_DB.TABLE_NAME.SELECT ← 'SELECT * FROM TABLE WHERE KEY = ''val'' '
result ← *SQL* MY_DB.TABLE_NAME.SELECT
In this case the variable-root-name MY_DB serves as container for all
variables being used in conjunction with DB named MY_DB.
Best Regards
Hans-Peter