This patch is against 21.1. The next patch will be against 21.2 and
go to xemacs-patches. I plan on maintaining a version of this patch
against 21.1 until 21.2 is released, though I don't know yet where I'm
going to put it.
Changes from the last posting: All of the API except copy in/out and
asynchronous notification has been implemented. I have not yet
converted certain error returns to signals, but will prior to final
integration. There is now a comprehensive programmer's manual, with
many, many examples. I have made PQclear and PQfinish visible to
Lisp, though they will cause crashes at least at the next garbage
collection. The code in the stub file, lisp/pg-util.el was moved into
the programmer's manual. There is a TODO list in postgresql.c that
list the items I feel are incomplete.
The new files src/postgresql.h, src/postgresql.c,
man/lispref/postgresql.texi are attached at the end of this message.
Questions, comments, discussion welcome. SQL in an Emacs Lisp
Interaction buffer rocks.
ChangeLog:
2000-03-06 SL Baur <steve(a)musashimaru.m17n.org>
* configure.in: add autodetection of PostgreSQL runtime libraries
src/ChangeLog:
2000-03-06 SL Baur <steve(a)musashimaru.m17n.org>
* config.h.in: Add symbols HAVE_POSTGRESQL and HAVE_POSTGRESQLV7
* inline.c: Include postgresql.h lrecord stuffs to placate buggy
GCCs.
* emacs.c (main_1): Call postgres initialization code.
* postgresql.h: New file. PostgreSQL RDBMS support.
* postgresql.c: New file.
man/ChangeLog:
2000-03-07 SL Baur <steve(a)musashimaru.m17n.org>
* lispref/postgresql.texi (PostgreSQL Support): New File.
* lispref/ldap.texi: Insert PostgreSQL/libpq chapter.
* lispref/lispref.texi (Top): Ditto.
* lispref/internationalization.texi: Ditto.
Index: configure.in
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/configure.in,v
retrieving revision 1.138
diff -u -r1.138 configure.in
--- configure.in 2000/02/09 01:40:53 1.138
+++ configure.in 2000/03/08 03:32:51
@@ -497,6 +497,7 @@
with_sparcworks | \
with_tooltalk | \
with_ldap | \
+ with_postgresql | \
with_pop | \
with_kerberos | \
with_hesiod | \
@@ -2698,6 +2699,55 @@
fi
fi
+dnl Autodetect PostgreSQL
+dnl The default installation location (non-Linux) is /usr/local/pgsql;
+dnl a different prefix can be selected at build/install time. If PostgreSQL
+dnl is installed into a different prefix, that prefix must be specified in
+dnl in the --site-prefixes flag.
+dnl The default RPM-based Linux installation location is /usr.
+AC_CHECKING(for PostgreSQL)
+postgres_includes_found=no
+save_c_switch_site="$c_switch_site"
+dnl First check site prefixes
+if test "$with_postgresql" != "no"; then
+ AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+fi
+dnl test for Linux-style installation in /usr
+if test "$postgres_includes_found" = "no" -a
"$with_postgresql" != "no" -a \
+ -d "/usr/include/pgsql"; then
+ c_switch_site="$c_switch_site -I/usr/include/pgsql"
+ AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+ if test "$postgres_includes_found" != "yes"; then
+ c_switch_site="$save_c_switch_site"
+ fi
+fi
+if test "$postgres_includes_found" = "no" -a
"$with_postgresql" != "no" -a \
+ -d "/usr/local/pgsql/include"; then
+ c_switch_site="$c_switch_site -I/usr/local/pgsql/include"
+ AC_CHECK_HEADER(libpq-fe.h,postgres_includes_found=yes)
+ if test "$postgres_includes_found" != "yes"; then
+ c_switch_site="$save_c_switch_site"
+ fi
+fi
+
+dnl last check -- can we link against libpq?
+if test "$postgres_includes_found" = "yes"; then
+ AC_CHECK_LIB(pq,PQconnectdb,with_postgresql=yes,with_postgresql=no)
+fi
+if test "$with_postgresql" = "yes"; then
+ AC_CHECK_LIB(pq,PQconnectStart,with_postgresqlv7=yes,with_postgresqlv7=no)
+fi
+if test "$with_postgresql" = "yes"; then
+ AC_DEFINE(HAVE_POSTGRESQL)
+ if test "$with_postgresqlv7" = "yes"; then
+ AC_DEFINE(HAVE_POSTGRESQLV7)
+ fi
+ XE_PREPEND(-lpq, LIBS)
+ XE_ADD_OBJS(postgresql.o)
+else
+ c_switch_site=$save_c_switch_site
+fi
+
dnl ----------------------
dnl Graphics libraries
dnl ----------------------
@@ -4060,6 +4110,12 @@
test "$with_ns_ldap" = yes && echo " Compiling in support
for LDAP (Netscape SDK)."
test "$with_ldap" = yes -a "$with_umich_ldap" = no -a
"$with_ns_ldap" = no && echo " Compiling in support for LDAP
(Generic)."
+if test "$with_postgresql" = yes; then
+ echo " Compiling in support for PostgreSQL."
+ if test "$with_postgresqlv7" = yes; then
+ echo " Using PostgreSQL V7 bindings."
+ fi
+fi
test "$with_ncurses" = yes && echo " Compiling in support for
ncurses."
test "$with_gpm" = yes && echo " Compiling in support for
GPM (General Purpose Mouse)."
Index: man/lispref/internationalization.texi
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/man/lispref/internationalization.texi,v
retrieving revision 1.2
diff -u -r1.2 internationalization.texi
--- man/lispref/internationalization.texi 1998/07/10 02:49:03 1.2
+++ man/lispref/internationalization.texi 2000/03/08 03:32:56
@@ -3,7 +3,7 @@
@c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
@c See the file lispref.texi for copying conditions.
@setfilename ../../info/internationalization.info
-@node Internationalization, MULE, LDAP Support, top
+@node Internationalization, MULE, PostgreSQL Support, top
@chapter Internationalization
@menu
Index: man/lispref/ldap.texi
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/man/lispref/ldap.texi,v
retrieving revision 1.1
diff -u -r1.1 ldap.texi
--- man/lispref/ldap.texi 1998/07/10 02:56:12 1.1
+++ man/lispref/ldap.texi 2000/03/08 03:32:56
@@ -3,7 +3,7 @@
@c Copyright (C) 1998 Free Software Foundation, Inc.
@c See the file lispref.texi for copying conditions.
@setfilename ../../info/ldap.info
-@node LDAP Support, Internationalization, ToolTalk Support, top
+@node LDAP Support, PostgreSQL Support, ToolTalk Support, top
@chapter LDAP Support
@cindex LDAP
Index: man/lispref/lispref.texi
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/man/lispref/lispref.texi,v
retrieving revision 1.12
diff -u -r1.12 lispref.texi
--- man/lispref/lispref.texi 1999/05/13 16:14:08 1.12
+++ man/lispref/lispref.texi 2000/03/08 03:32:56
@@ -204,6 +204,7 @@
* ToolTalk Support:: Interfacing with the ToolTalk message service.
* LDAP Support:: Interfacing with the Lightweight Directory
Access Protocol.
+* PostgreSQL Support:: Interfacing to the PostgreSQL libpq library.
* Internationalization:: How Emacs supports different languages and
cultural conventions.
* MULE:: Specifics of the Asian-language support.
@@ -1199,6 +1200,7 @@
@include x-windows.texi
@include tooltalk.texi
@include ldap.texi
+@include postgresql.texi
@include internationalization.texi
@include mule.texi
Index: src/config.h.in
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/config.h.in,v
retrieving revision 1.53
diff -u -r1.53 config.h.in
--- src/config.h.in 1999/07/07 03:10:32 1.53
+++ src/config.h.in 2000/03/08 03:33:00
@@ -357,6 +357,11 @@
/* Do we have Netscape LDAP SDK library */
#undef HAVE_NS_LDAP
+/* Do we wish to link against the PostgreSQL RDBMS run-time library?
+ */
+#undef HAVE_POSTGRESQL
+#undef HAVE_POSTGRESQLV7
+
/* Do you have the Xauth library present? This will add some extra
functionality to gnuserv. */
#undef HAVE_XAUTH
Index: src/emacs.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/emacs.c,v
retrieving revision 1.93
diff -u -r1.93 emacs.c
--- src/emacs.c 1999/12/04 04:13:05 1.93
+++ src/emacs.c 2000/03/08 03:33:01
@@ -1062,6 +1062,10 @@
syms_of_eldap ();
#endif
+#ifdef HAVE_POSTGRESQL
+ syms_of_postgresql ();
+#endif
+
/* Now create the subtypes for the types that have them.
We do this before the vars_*() because more symbols
may get initialized here. */
@@ -1437,6 +1441,10 @@
#ifdef HAVE_LDAP
vars_of_eldap ();
+#endif
+
+#ifdef HAVE_POSTGRESQL
+ vars_of_postgresql();
#endif
/* Now initialize any specifier variables. We do this later
Index: src/inline.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/inline.c,v
retrieving revision 1.12
diff -u -r1.12 inline.c
--- src/inline.c 1998/05/24 05:40:44 1.12
+++ src/inline.c 2000/03/08 03:33:01
@@ -67,6 +67,11 @@
#include "eldap.h"
#endif
+#ifdef HAVE_POSTGRESQL
+#include <libpq-fe.h>
+#include "postgresql.h"
+#endif
+
#ifdef HAVE_TOOLBARS
#include "toolbar.h"
#endif