Using a relational database as a Mumps backend store

This is a discussion on Using a relational database as a Mumps backend store within the mumps forums in Programming Languages category; A new experimental version of our Mumps interpreter is available at: http://www.cs.uni.edu/~okane/source/...eta.src.tar.gz Further details as: http://www.cs.uni.edu/~okane This version permits the PostgreSQL database server: http://www.postgresql.org/ to be used to store/retrieve Mumps global arrays. In the past, we have supported a native global array handler which is very fast but not fault tolerant. We also supported the Berkeley Database until its acquisition by Oracle. While this is a very fault tolerant system, it is also proprietary and has distribution limitations. PostgreSQL, on the other hand, is a widely used, thoroughly fault tolerant and completely free, open-source package. In many tests, it outperforms ...

Go Back   Application Development Forum > Programming Languages > mumps

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-13-2008, 05:57 PM
Kevin O'Kane
Guest
 
Default Using a relational database as a Mumps backend store

A new experimental version of our Mumps interpreter is available at:

http://www.cs.uni.edu/~okane/source/...eta.src.tar.gz

Further details as:

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

This version permits the PostgreSQL database server:

http://www.postgresql.org/

to be used to store/retrieve Mumps global arrays.

In the past, we have supported a native global array handler which is
very fast but not fault tolerant. We also supported the Berkeley
Database until its acquisition by Oracle. While this is a very
fault tolerant system, it is also proprietary and has distribution
limitations.

PostgreSQL, on the other hand, is a widely used, thoroughly fault tolerant
and completely free, open-source package. In many tests, it outperforms
its commercial counterparts.

While our native global array handler is very much faster, PostgreSQL
has the advantages of being fault-tolerant, multi-user, network accessible,
accessible from C/C++, Java, .Net, Perl, Python, Ruby, Tcl, and ODBC, among
others.

In this new version, global array data bases built by Mumps programs can also
be retrieved, updated and manipulated by SQL commands. A short example follows:


A small Mumps program to create a tiny data base:

#!/usr/bin/mumps

sql/f

set ^lab(1111,"hct",$zd1,44)=""
set ^lab(2222,"hct",$zd1,45)=""
set ^lab(3333,"hct",$zd1,46)=""
set ^lab(4444,"hct",$zd1,47)=""
set ^lab(5555,"hct",$zd1,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")=""

The first line (#!/usr/bin/mumps) starts the Mumps interpreter under Linux.
The command: sql/f clears the SQL server Mumps data base. $zd1 is a builtin
variable in our system that gives the Linux system time (number of seconds
since Jan 1, 1970) The remainder should be famliar.

All of the usual Mumps functions such as $order() and $data() work as
expected.

Because the Mumps globals reside in relational tables, they are also accessible
to SQL queries.

Having run the above, we accessed it using the simple pgsql program which
is part of the PostgreSQL distro (note: views can be created and column names
aliased in SQL so the column headings A1, A2, ... can be altered):

okane@emachines:~/mumps/demos$ psql -d mumps

Welcome to psql 8.3.1, the PostgreSQL interactive terminal.

Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit

mumps=# select * from mumps;

gbl | a1 | a2 | a3 | a4 | a5 | a6 | a7 | a8 | a9 | a10
------+------+------------+------------+----+----+----+----+----+----+-----+-----
lab | 1111 | hct | 1213390964 | 44 | | | | | | |
lab | 2222 | hct | 1213390964 | 45 | | | | | | |
lab | 3333 | hct | 1213390964 | 46 | | | | | | |
lab | 4444 | hct | 1213390964 | 47 | | | | | | |
lab | 5555 | hct | 1213390964 | 48 | | | | | | |
bp | 1111 | 1213390964 | 128 | 70 | | | | | | |
bp | 2222 | 1213390964 | 127 | 71 | | | | | | |
bp | 3333 | 1213390964 | 126 | 72 | | | | | | |
bp | 4444 | 1213390964 | 125 | 73 | | | | | | |
bp | 5555 | 1213390964 | 124 | 74 | | | | | | |
prob | 1111 | 1213390964 | 123.45 | | | | | | | |
prob | 2222 | 1213390964 | 223.45 | | | | | | | |
prob | 3333 | 1213390964 | 323.45 | | | | | | | |
prob | 4444 | 1213390964 | 423.45 | | | | | | | |
prob | 5555 | 1213390964 | 523.45 | | | | | | | |
(15 rows)


mumps=# select a1 from mumps where gbl = 'lab' and a2 = 'hct' and a4 > '45';

a1
------
3333
4444
5555
(3 rows)

----------------------------------------------------------------------------------------------------

Overall performance is about 0.005 seconds per global array insert on a four year old
desktop PC running the current version of Ubuntu. The test consisted of the insertion
and retrieval of 100,000 Mumps randomly generated Mumps globals.

Mumps can access other relational tables if appropriate views are first constructed. Full access
to relational tables is under development.

The Mumps command 'sql' permits any SQL or PostgreSQL command to be passed to and
processed by the backend. This command is similar to our shell and html commands
in that Mumps variables and expressions can be embedded into the SQL command.

Full documentation is under development but for the time being, see the file POSTGRESS_README
in the distribution.

This package works with Linux and Cygwin and is compatible with the Apache web server for
active server pages.
Reply With Quote
  #2  
Old 06-17-2008, 02:12 PM
Mike
Guest
 
Default Re: Using a relational database as a Mumps backend store

On 13 Jun, 17:57, Kevin O'Kane <ok...@cs.uni.edu> wrote:
> A new experimental version of our Mumps interpreter is available at:
>
> http://www.cs.uni.edu/~okane/source/...iler-11.beta.s...
>


Kevin,

Does your mumps compiler run only on linux/unix or does it run on
windows also? Has anyone used you compiler for a commercial
application?

Mike Minor
Z-Code Sysems, Inc.
Reply With Quote
  #3  
Old 06-18-2008, 11:00 AM
Kevin O'Kane
Guest
 
Default Re: Using a relational database as a Mumps backend store

On Tue, 17 Jun 2008 11:12:39 -0700, Mike wrote:

> On 13 Jun, 17:57, Kevin O'Kane <ok...@cs.uni.edu> wrote:
>> A new experimental version of our Mumps interpreter is available at:
>>
>> http://www.cs.uni.edu/~okane/source/...iler-11.beta.s...
>>
>>

> Kevin,
>
> Does your mumps compiler run only on linux/unix or does it run on
> windows also? Has anyone used you compiler for a commercial application?
>
> Mike Minor
> Z-Code Sysems, Inc.


My developement is in Linux. It also runs in Cygwin for windows
which means that, with the Cygwin DLL accessible, it will run
in a command prompt. PostgreSQL also works with Cygwin.
Performance is comparable to Linux. Cygwin is a free product.

Periodically, I do a build for Windows using the MS Visual C++
product. I will be doing a Windows build of the new code soon
and hope to test it with a Windows native version of the
PostgreSQL server. The link on my web download page to the
mumps.exe is a recent Windows build but it does not have the
PostgreSQL code in it yet. This is the interpreter version.

Lately, we've been using the interpreter more in that it's more
shell like and the performance hit is minimal when used in a
high data base access mode.

I don't know what use people who have downloaded have made of
it. We use in classes in information storage and retrieval
for which Mumps is very well suited. The link:

http://www.cs.uni.edu/~okane/source/ISR/isr.html

is to a rambling online text that's been accumulating for
several years. It contains lots of example Mumps code.
Reply With Quote
  #4  
Old 07-08-2008, 05:23 PM
David Hubball
Guest
 
Default Re: Using a relational database as a Mumps backend store

Hi Kevin
I've just set up mumps.exe for Windows XP but can't seem to run a
program. I saved the routine into the same directory as mumps.exe. I
just want to try from a basic edittor for now so I can see if it meets
my needs as someone who has just started a career as a mumps
programmer.

I created a program file called atest.mps (using the vim editor)but
when I run these commands it shows these errors :-
> mumps atest.mps


*** in or near line 3 Keyword*** mumps atest.mp

> atest.mps


*** in or near line 3 Keyword*** atest.mps

The program reads :-
ATEST ;NEW PROG TO TEST KEVINS MUMPS
W "HELLO"
Q

Can you please advise to help me off the ground.

Kind Regards
David
Reply With Quote
  #5  
Old 07-11-2008, 08:31 AM
Kevin O'Kane
Guest
 
Default Re: Using a relational database as a Mumps backend store

On Tue, 08 Jul 2008 14:23:34 -0700, David Hubball wrote:

> ATEST ;NEW PROG TO TEST KEVINS MUMPS
> W "HELLO"
> Q


I don't seem to be able to reproduce the error. I copied your
program to my directory and ran it under Windows XP. I also
checked it out under Cygwin with the same results (hence
the extra line at the front which is ignored by Windows):

F: >type atst.mps
#!/usr/bin/mumps
ATEST ;NEW PROG TO TEST KEVINS MUMPS
W "HELLO"
Q

Execution by GOTO from interpreter:

F: >mumps

Mumps Interpreter V10.0 Fri Jul 11 08:21:01 2008

> g ^atst.mps

HELLO> h

execution by interpreter from command line parameter:

F: >mumps atst.mps
HELLO
F: >


-------------------------------------

Cygwin:

script interpreter mode:

(code needs ! after Hello in write hence missing new line)

user@acer atst.mps
HELLOuser@acer
user@acer


compile mode:

user@acer mumpsc atst.mps

Compiling from Mumps source ...
The Mumps Compiler 10.00 Jun 25 2008
Translating ./atst.mps to C++:
4 lines of Mumps; 210 lines of C++ generated
using mpsglobal_native file system
Compiling generated C++ code...
Info: resolving _pcre_free by linking to __imp__pcre_free (auto-import)

user@acer atst
HELLO
*** Too many Quits in or near line 4

Program terminated by signal 100 Software Error
Globals arrays saved

command line parm interpreter execution:

user@acer mumps atst.mps

HELLOuser@acer

user@acer cat atst.mps
#!/usr/bin/mumps
ATEST ;NEW PROG TO TEST KEVINS MUMPS
W "HELLO"
Q
user@acer


Note: the error from the compile run in Cygwin is due to the quit
which should be a halt. This is normal. The interpreters ignore
this error.
Reply With Quote
  #6  
Old 07-12-2008, 03:59 PM
David Hubball
Guest
 
Default Re: Using a relational database as a Mumps backend store

Hi Kevin

Sorry my fault I think. I read the user guide which reads :-
To interpret a program, type:

mumps myprog.mps

I assumed that this was from withing the mumps.exe session rather than
dos. It works fine with the g ^atest from the mumps prompt as well.

Thanks - all is fine now
David
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:12 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.