From 676404d5dc9a98884a99916ec9b6801b32df2bca Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 11 Oct 1999 17:47:02 +0000 Subject: [PATCH] Add pginterface into main tree, called pgeasy. --- contrib/README | 8 -- contrib/findoidjoins/README | 2 +- contrib/pginterface/Makefile | 32 -------- contrib/pginterface/README | 15 ---- src/configure.in | 1 + src/interfaces/Makefile | 3 +- src/interfaces/libpgtcl/Makefile.in | 4 +- src/interfaces/libpq/Makefile.in | 4 +- src/interfaces/pgeasy/Makefile.in | 89 ++++++++++++++++++++++ src/interfaces/pgeasy/README | 10 +++ src/interfaces/pgeasy/examples/Makefile | 27 +++++++ .../interfaces/pgeasy/examples}/pginsert.c | 2 +- .../interfaces/pgeasy/examples}/pgnulltest.c | 2 +- .../interfaces/pgeasy/examples}/pgwordcount.c | 2 +- .../pginterface => src/interfaces/pgeasy}/halt.c | 0 .../pginterface => src/interfaces/pgeasy}/halt.h | 0 .../interfaces/pgeasy/pgeasy.3 | 10 +-- .../interfaces/pgeasy/pgeasy.c | 4 +- .../interfaces/pgeasy/pgeasy.h | 0 19 files changed, 144 insertions(+), 71 deletions(-) delete mode 100644 contrib/pginterface/Makefile delete mode 100644 contrib/pginterface/README create mode 100644 src/interfaces/pgeasy/Makefile.in create mode 100644 src/interfaces/pgeasy/README create mode 100644 src/interfaces/pgeasy/examples/Makefile rename {contrib/pginterface => src/interfaces/pgeasy/examples}/pginsert.c (98%) rename {contrib/pginterface => src/interfaces/pgeasy/examples}/pgnulltest.c (99%) rename {contrib/pginterface => src/interfaces/pgeasy/examples}/pgwordcount.c (97%) rename {contrib/pginterface => src/interfaces/pgeasy}/halt.c (100%) rename {contrib/pginterface => src/interfaces/pgeasy}/halt.h (100%) rename contrib/pginterface/pginterface.3 => src/interfaces/pgeasy/pgeasy.3 (87%) rename contrib/pginterface/pginterface.c => src/interfaces/pgeasy/pgeasy.c (99%) rename contrib/pginterface/pginterface.h => src/interfaces/pgeasy/pgeasy.h (100%) diff --git a/contrib/README b/contrib/README index af9747644b..a59880c265 100644 --- a/contrib/README +++ b/contrib/README @@ -50,14 +50,6 @@ mSQL-interface - noupdate - trigger to prevent updates on single columns -plpgsql - - Postgres procedural language - by Jan Wieck - -pginterface - - A crude C/4GL - by Bruce Momjian - soundex - Prototype for soundex function diff --git a/contrib/findoidjoins/README b/contrib/findoidjoins/README index 26086a6c41..c67d341339 100644 --- a/contrib/findoidjoins/README +++ b/contrib/findoidjoins/README @@ -6,7 +6,7 @@ and the tables they join to. CAUTION: it is ver-r-r-y slow on a large database, or even a not-so-large one. We don't really recommend running it on anything but an empty database. -It requires pgsql/contrib/pginterface to be compiled first. +Uses pgeasy library. Run on an empty database, it returns the system join relationships (shown below for 6.5). Note that unexpected matches may indicate bogus entries diff --git a/contrib/pginterface/Makefile b/contrib/pginterface/Makefile deleted file mode 100644 index eea02e8f12..0000000000 --- a/contrib/pginterface/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# Makefile -# -# -PGINTERFACE = pginterface.o halt.o -TARGET = pginsert pgwordcount pgnulltest -CFLAGS = -g -Wall -I. -I../../src/interfaces/libpq -I/usr/local/pgsql/include -LDFLAGS = -L/usr/local/pgsql/lib -lpq - -all : $(TARGET) - -pginsert: $(PGINTERFACE) pginsert.c - gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS) - -pgwordcount: $(PGINTERFACE) pgwordcount.c - gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS) - -pgnulltest: $(PGINTERFACE) pgnulltest.c - gcc -o $@ $(CFLAGS) $@.c $(PGINTERFACE) $(LDFLAGS) - -pginterface.o: pginterface.c - gcc -c $(CFLAGS) pginterface.c - -halt.o: halt.c - gcc -c $(CFLAGS) halt.c - -clean: - rm -f *.o $(TARGET) log core - -install: - install -s -o bin -g bin $(TARGET) /usr/local/pgsql/bin - diff --git a/contrib/pginterface/README b/contrib/pginterface/README deleted file mode 100644 index 5190acc0cf..0000000000 --- a/contrib/pginterface/README +++ /dev/null @@ -1,15 +0,0 @@ - - - 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. - -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) diff --git a/src/configure.in b/src/configure.in index a02a46778f..115096f724 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1220,6 +1220,7 @@ AC_OUTPUT( interfaces/libpq/Makefile interfaces/ecpg/lib/Makefile interfaces/libpq++/Makefile + interfaces/libpgeasy/Makefile interfaces/libpgtcl/Makefile interfaces/odbc/GNUmakefile interfaces/odbc/Makefile.global diff --git a/src/interfaces/Makefile b/src/interfaces/Makefile index 632ae7832d..ae54cd29d0 100644 --- a/src/interfaces/Makefile +++ b/src/interfaces/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.27 1999/10/08 04:28:57 momjian Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.28 1999/10/11 17:46:58 momjian Exp $ # #------------------------------------------------------------------------- @@ -44,6 +44,7 @@ endif ifeq ($(USE_ODBC), true) $(MAKE) -C odbc $@ endif + $(MAKE) -C pgeasy$@ perl5/Makefile: perl5/Makefile.PL cd perl5 && $(PERL) Makefile.PL diff --git a/src/interfaces/libpgtcl/Makefile.in b/src/interfaces/libpgtcl/Makefile.in index 1912c1198c..7e35160380 100644 --- a/src/interfaces/libpgtcl/Makefile.in +++ b/src/interfaces/libpgtcl/Makefile.in @@ -6,7 +6,7 @@ # Copyright (c) 1994, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.35 1999/06/30 23:57:24 tgl Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.36 1999/10/11 17:46:59 momjian Exp $ # #------------------------------------------------------------------------- @@ -52,7 +52,7 @@ beforeinstall-headers: .PHONY: clean clean: clean-shlib - rm -f $(OBJS) lib$(NAME).a + rm -f lib$(NAME).a $(OBJS) depend dep: $(CC) -MM $(CFLAGS) *.c >depend diff --git a/src/interfaces/libpq/Makefile.in b/src/interfaces/libpq/Makefile.in index ec955dcd4b..e67ee1d2ca 100644 --- a/src/interfaces/libpq/Makefile.in +++ b/src/interfaces/libpq/Makefile.in @@ -6,7 +6,7 @@ # Copyright (c) 1994, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.47 1999/08/31 01:37:36 tgl Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.48 1999/10/11 17:47:01 momjian Exp $ # #------------------------------------------------------------------------- @@ -86,7 +86,7 @@ install-headers: libpq-fe.h libpq-int.h .PHONY: clean clean: clean-shlib - rm -f libpq.a $(OBJS) + rm -f lib$(NAME).a $(OBJS) rm -f dllist.c common.c wchar.c conv.c big5.c ifeq ($(PORTNAME), win) rm -f pq.def diff --git a/src/interfaces/pgeasy/Makefile.in b/src/interfaces/pgeasy/Makefile.in new file mode 100644 index 0000000000..f535e46e39 --- /dev/null +++ b/src/interfaces/pgeasy/Makefile.in @@ -0,0 +1,89 @@ +#------------------------------------------------------------------------- +# +# Makefile +# Makefile for pgeasy library +# +# IDENTIFICATION +# $Header: /cvsroot/pgsql/src/interfaces/pgeasy/Attic/Makefile.in,v 1.1 1999/10/11 17:47:01 momjian Exp $ +# +#------------------------------------------------------------------------- + +NAME= pgeasy +SO_MAJOR_VERSION= 2 +SO_MINOR_VERSION= 0 + +SRCDIR= @top_srcdir@ +include $(SRCDIR)/Makefile.global + +ifdef KRBVERS +CFLAGS+= $(KRBFLAGS) +endif + +OBJS= pgeasy.o halt.o + +SHLIB_LINK+= -L../libpq -lpq + +SHLIB_LINK+= -L../libpq -lpq + +# If crypt is a separate library, rather than part of libc, it may need +# to be referenced separately to keep (broken) linkers happy. (This is +# braindead; users of libpq should not need to know what it depends on.) +SHLIB_LINK+= $(findstring -lcrypt,$(LIBS)) + +# Shared library stuff, also default 'all' target +include $(SRCDIR)/Makefile.shlib + + +.PHONY: install install-headers + +install: install-headers install-lib $(install-shlib-dep) + +install-headers: pgeasy.h + @if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi + $(INSTALL) $(INSTLOPTS) pgeasy.h $(HEADERDIR)/pgeasy.h + +.PHONY: clean + +clean: clean-shlib + rm -f lib$(NAME).a $(OBJS) + +depend dep: + $(CC) -MM $(CFLAGS) *.c >depend + +ifeq (depend,$(wildcard depend)) +include depend +endif + + + +PGEASY = pgeasy.o halt.o +TARGET = libpgeasy.a pginsert pgwordcount pgnulltest +CFLAGS = -g -Wall -I. -I../../src/interfaces/libpq -I/usr/local/pgsql/include +LDFLAGS = -L/usr/local/pgsql/lib -lpq + +all : $(TARGET) + +libpgeasy.a: pgeasy.o halt.o + ar r libpgeasy.a pgeasy.o halt.o + +pgeasy.o: pgeasy.c + gcc -c $(CFLAGS) pgeasy.c + +halt.o: halt.c + gcc -c $(CFLAGS) halt.c + +pginsert: $(PGEASY) pginsert.c + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +pgwordcount: $(PGEASY) pgwordcount.c + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +pgnulltest: $(PGEASY) pgnulltest.c + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +clean: + rm -f *.o $(TARGET) log core + +install: + install -s -o bin -g bin $(TARGET) /usr/local/pgsql/bin + diff --git a/src/interfaces/pgeasy/README b/src/interfaces/pgeasy/README new file mode 100644 index 0000000000..b8e26d40a1 --- /dev/null +++ b/src/interfaces/pgeasy/README @@ -0,0 +1,10 @@ + + + Pgeasy 2.0 + (Formerly contrib/pginterface) + +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. + +Bruce Momjian (root@candle.pha.pa.us) diff --git a/src/interfaces/pgeasy/examples/Makefile b/src/interfaces/pgeasy/examples/Makefile new file mode 100644 index 0000000000..fd13c1eb06 --- /dev/null +++ b/src/interfaces/pgeasy/examples/Makefile @@ -0,0 +1,27 @@ +#------------------------------------------------------------------------- +# +# Makefile +# Makefile for pgeasy examples +# +# IDENTIFICATION +# $Header: /cvsroot/pgsql/src/interfaces/pgeasy/examples/Attic/Makefile,v 1.1 1999/10/11 17:47:02 momjian Exp $ +# +#------------------------------------------------------------------------- + +TARGET = pginsert pgwordcount pgnulltest +LDFLAGS = -lpgeasy + +all : $(TARGET) + +pginsert: + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +pgwordcount: + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +pgnulltest: + gcc -o $@ $(CFLAGS) $@.c $(PGEASY) $(LDFLAGS) + +clean: + rm -f *.o $(TARGET) log core + diff --git a/contrib/pginterface/pginsert.c b/src/interfaces/pgeasy/examples/pginsert.c similarity index 98% rename from contrib/pginterface/pginsert.c rename to src/interfaces/pgeasy/examples/pginsert.c index ad0811c88a..7cb2cf5b26 100644 --- a/contrib/pginterface/pginsert.c +++ b/src/interfaces/pgeasy/examples/pginsert.c @@ -7,7 +7,7 @@ #include #include #include "halt.h" -#include "pginterface.h" +#include "pgeasy.h" int main(int argc, char **argv) diff --git a/contrib/pginterface/pgnulltest.c b/src/interfaces/pgeasy/examples/pgnulltest.c similarity index 99% rename from contrib/pginterface/pgnulltest.c rename to src/interfaces/pgeasy/examples/pgnulltest.c index bb02fa628e..4651d77bac 100644 --- a/contrib/pginterface/pgnulltest.c +++ b/src/interfaces/pgeasy/examples/pgnulltest.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include int main(int argc, char **argv) diff --git a/contrib/pginterface/pgwordcount.c b/src/interfaces/pgeasy/examples/pgwordcount.c similarity index 97% rename from contrib/pginterface/pgwordcount.c rename to src/interfaces/pgeasy/examples/pgwordcount.c index 4fe23187f0..4715f88f43 100644 --- a/contrib/pginterface/pgwordcount.c +++ b/src/interfaces/pgeasy/examples/pgwordcount.c @@ -6,7 +6,7 @@ #include #include "halt.h" #include -#include "pginterface.h" +#include "pgeasy.h" int main(int argc, char **argv) diff --git a/contrib/pginterface/halt.c b/src/interfaces/pgeasy/halt.c similarity index 100% rename from contrib/pginterface/halt.c rename to src/interfaces/pgeasy/halt.c diff --git a/contrib/pginterface/halt.h b/src/interfaces/pgeasy/halt.h similarity index 100% rename from contrib/pginterface/halt.h rename to src/interfaces/pgeasy/halt.h diff --git a/contrib/pginterface/pginterface.3 b/src/interfaces/pgeasy/pgeasy.3 similarity index 87% rename from contrib/pginterface/pginterface.3 rename to src/interfaces/pgeasy/pgeasy.3 index 22dfb5d559..a24bc04110 100644 --- a/contrib/pginterface/pginterface.3 +++ b/src/interfaces/pgeasy/pgeasy.3 @@ -1,9 +1,9 @@ .\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... -.\" $Header: /cvsroot/pgsql/contrib/pginterface/Attic/pginterface.3,v 1.1 1998/09/11 05:14:08 momjian Exp $ -.TH PGINTERFACE INTRO 08/08/98 PostgreSQL PostgreSQL +.\" $Header: /cvsroot/pgsql/src/interfaces/pgeasy/Attic/pgeasy.3,v 1.1 1999/10/11 17:47:01 momjian Exp $ +.TH PGEASY INTRO 08/08/98 PostgreSQL PostgreSQL .SH DESCRIPTION -Pginterface allows you to cleanly interface to the libpq library, +Pgeasy allows you to cleanly interface to the libpq library, more like a 4gl SQL interface. .PP It consists of set of simplified C functions that encapsulate the @@ -46,7 +46,7 @@ queries, allows you to pass pointers as parameters, and on return the variables are filled with data from the binary cursor you opened. These binary cursors can not be used if you are running the -.BR pginterface +.BR pgeasy client on a system with a different architecture than the database server. If you pass a NULL pointer parameter, the column is skipped. .BR fetchwithnulls @@ -67,5 +67,5 @@ and allow you to handle multiple result sets at the same time. .PP There are a variety of demonstration programs in the -.BR pginterface +.BR pgeasy source directory. diff --git a/contrib/pginterface/pginterface.c b/src/interfaces/pgeasy/pgeasy.c similarity index 99% rename from contrib/pginterface/pginterface.c rename to src/interfaces/pgeasy/pgeasy.c index 1da61aae49..f3d6aae01e 100644 --- a/contrib/pginterface/pginterface.c +++ b/src/interfaces/pgeasy/pgeasy.c @@ -1,5 +1,5 @@ /* - * pginterface.c + * pgeasy.c * */ @@ -9,7 +9,7 @@ #include #include "halt.h" -#include "pginterface.h" +#include "pgeasy.h" #define NUL '\0' diff --git a/contrib/pginterface/pginterface.h b/src/interfaces/pgeasy/pgeasy.h similarity index 100% rename from contrib/pginterface/pginterface.h rename to src/interfaces/pgeasy/pgeasy.h -- 2.11.0