Re: [INTERFACES] Character mode forms designer

From: "Billy G(dot) Allie" <Bill(dot)Allie(at)mug(dot)org>
To: Chris Newman <chris(at)lightwood(dot)demon(dot)co(dot)uk>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: [INTERFACES] Character mode forms designer
Date: 1998-07-11 04:23:18
Message-ID: 199807110423.AAA05422@bgalli.mug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I create character mode applications using a tool available on System 5
Release 4 based UNIXs (UnixWare, Solaris and others) call FMLI [ Form and Menu
Language Interpreter ]. Communication with the database is through a program
I wrote that is similar to psql, but is designed to function as a co-process
with FMLI.
The program (I call 'getsql') receives SQL queries via STDIN and sends the
results to STDOUT with each field delimited by a TAB or, optionally, any other
character. After all the rows have been output, a end of rows sentinal is
output to let FMLI that there are no more rows. Also, special care is taken
to ensure that the output buffers are flushed.

I have also used this program to allow programs such as 'awk' and 'ksh' to
interacte with postgreSQL by running getsql with STDIN and STDOUT attached to
named pipes.

The following shows how I connect to postgreSQL with FMLI.

banner="CMS Version 2.1"
title="WLECOME TO"
columns = 35
rows=7
text="
The Choir Management System

Copyright 1995
Billy G. Allie
All Rights Reserved."
slk_layout=4-4
# Create the pipe to the database.
`cocreate -i PGSQL -e '*** END-OF-ROWS ***' getsql -p -D choir | message`

The following shows how I use a form to update a table in postgreSQL.

form="Add Entry"
done=`cosend -n PGSQL "insert into choir values (nextval('id'), ";
if [ "X$F1" = "X" ];
then cosend -n PGSQL "NULL, ";
else cosend -n PGSQL "$F1, ";
fi;
cosend PGSQL "'$F3', '$F2', '$mvalue', '$F5');" | message`update
Name="Folder No:"
nrow=1
ncol=1
frow=1
fcol=12
flen=5
rows=1
columns=5
valid=`[ "X$F1" = "X" ] ||
cosend PGSQL "select val1_id($F1);"`
invalidmsg="Folder number $F1 already exists!"
fieldmsg="Enter a unique number."

Name="Last Name:"
nrow=2
ncol=1
frow=2
fcol=12
flen=35
rows=1
columns=25
scroll
fieldmsg="Enter the last name of the new member."

[ remaining text removed ... ]

In the preceeding example, $F1 is the contents of Field #1 and val1_id() is a
SQL function that returns the string "TRUE" is $F1 already exists as an ID in
the database or "FALSE" if it does not.

All in all, if you have a need to do character mode applications with
postgreSQL and your system has FMLI, I would recommend using it. Also, if
there is interest, I will send 'getsql' to the contrib area on the postgreSQL
site.

--
____ | Billy G. Allie | Domain....: Bill(dot)Allie(at)mug(dot)org
| /| | 7436 Hartwell | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie(at)email(dot)msn(dot)com
|/ |LLIE | (313) 582-1540 |

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-07-11 14:09:16 Re: [INTERFACES] postgres for spatial data
Previous Message Chris Newman 1998-07-10 22:57:14 Character mode forms designer