postgresql/contrib/pginterface
1997-09-08 21:56:23 +00:00
..
halt.c Used modified version of indent that understands over 100 typedefs. 1997-09-08 21:56:23 +00:00
halt.h Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
Makefile Newer version of Bruce's pginterface library... 1996-09-19 20:19:05 +00:00
pginsert.c Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
pginterface.c Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
pginterface.h Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
pgnulltest.c Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
pgwordcount.c Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
README Updated version. 1996-09-26 14:07:07 +00:00


   			      Pginterface 2.0

Attached is a copy of the Postgres support routines I wrote to allow me
to more cleanly interface to the libpg library, more like a 4gl SQL
interface.

It has several features that may be useful for others:

I have simplified the C code that calls libpq by wrapping all the
functionality of libpq in calls to connectdb(), doquery(), fetch(),
fetchwithnulls() and disconnectdb().  Each call returns a structure or
value, so if you need to do more work with the result, you can.  Also, I
have a global variable that allows you to disable the error checking I
have added to the doquery() routine.

I have added a function called fetch(), which allows you to pass
pointers as parameters, and on return the variables are filled with the
data from the binary cursor you opened.  These binary cursors are not
useful if you are running the query engine on a system with a different
architecture than the database server.  If you pass a NULL pointer, the
column is skipped, and you can use libpq to handle it as you wish.

I have used sigprocmask() to block the reception of certain signals
while the program is executing SQL queries.  This prevents a user
pressing Control-C from stopping all the back ends.  It blocks SIGHUP,
SIGINT, and SIGTERM, but does not block SIGQUIT or obviously kill -9. 
If your platform does not support sigprocmask(), you can remove those
function calls.  ( Am I correct that abnormal termination can cause
shared memory resynchronization?)

There is a demo program called pginsert that demonstrates how the
library can be used.

You can create a library of pginterface.c and halt.c, and just include
pginterface.h in your source code.

I am willing to maintain this if people find problems or want additional
functionality. 

Bruce Momjian (root@candle.pha.pa.us)