Access to globals from SQL

This is a discussion on Access to globals from SQL within the mumps forums in Programming Languages category; A further example. The SQL command on a Mumps global array data base with tuple output to file ($j_".tmp"). Tuples are separated by <tab> chars. Backecnd provided by PostgreSQL. Mumps globals appear in SQL as tables with the column names: gbl, a1, a1, a2, ... a10. Data values appear as column name a10 (deeper tress are possible with a compile time parm change). Works with Cygwin and Linux. Not evaluated under M$ WIndows. see also: http://www.cs.uni.edu/~okane/ and http://www.lulu.com/content/2012905 #!/usr/bin/mumps sql/f set ^lab(1111,$zd1,"hct",44)="" set ^lab(2222,$zd1,"hct",45)="" set ^lab(3333,$zd1,"hct",46)="" set ^lab(4444,$zd1,"hct",47)="" set ^lab(5555,$zd1,"hct",48)="" set ^bp(1111,$zd1,128,70)="" set ^bp(2222,$zd1,127,71)="" set ^bp(3333,$zd1,126,72)="" set ^bp(4444,$zd1,125,73)="" set ^bp(5555,$zd1,124,74)="" ...

Go Back   Application Development Forum > Programming Languages > mumps

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-15-2008, 10:59 PM
Kevin O'Kane
Guest
 
Default Access to globals from SQL

A further example. The SQL command on a Mumps global array
data base with tuple output to file ($j_".tmp"). Tuples are
separated by <tab> chars. Backecnd provided by PostgreSQL.
Mumps globals appear in SQL as tables with the column
names: gbl, a1, a1, a2, ... a10. Data values appear as
column name a10 (deeper tress are possible with a compile
time parm change). Works with Cygwin and Linux. Not evaluated
under M$ WIndows.

see also:

http://www.cs.uni.edu/~okane/

and

http://www.lulu.com/content/2012905


#!/usr/bin/mumps

sql/f

set ^lab(1111,$zd1,"hct",44)=""
set ^lab(2222,$zd1,"hct",45)=""
set ^lab(3333,$zd1,"hct",46)=""
set ^lab(4444,$zd1,"hct",47)=""
set ^lab(5555,$zd1,"hct",48)=""

set ^bp(1111,$zd1,128,70)=""
set ^bp(2222,$zd1,127,71)=""
set ^bp(3333,$zd1,126,72)=""
set ^bp(4444,$zd1,125,73)=""
set ^bp(5555,$zd1,124,74)=""

set ^prob(1111,$zd1,"123.45")=""
set ^prob(2222,$zd1,"223.45")=""
set ^prob(3333,$zd1,"323.45")=""
set ^prob(4444,$zd1,"423.45")=""
set ^prob(5555,$zd1,"523.45")=""

sql/o=$j_".tmp" select * from mumps where a1='3333';

open 1:$j_".tmp,old"
if '$test write "file not found",! halt

for do
. use 1
. read a
. if '$test break
. use 5
. for i=1:1 do
.. set b=$piece(a," ",i) // <tab> in quotes
.. if b="" break
.. write b," ... "
. write !

output:

lab ... 3333 ... 1213545964 ... hct ... 46 ...
bp ... 3333 ... 1213545964 ... 126 ... 72 ...
prob ... 3333 ... 1213545964 ... 323.45 ...
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:16 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.