aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>2002-08-22 00:15:14 +0000
committerMarc G. Fournier <scrappy@hub.org>2002-08-22 00:15:14 +0000
commitda4683fbe1cba48cf5b5b29055b66e0bacb00162 (patch)
tree87834b1b18614313e895dcc8c504f58af9f6b4b2 /src
parentb663f3443ba096a06970214c3e83e79f6e570b84 (diff)
downloadpostgresql-da4683fbe1cba48cf5b5b29055b66e0bacb00162.tar.gz
postgresql-da4683fbe1cba48cf5b5b29055b66e0bacb00162.zip
Okay, libpq++ is moved to GBorg, and all traces of it have been removed
from the core repository ... I haven't *moved* the libpq++ files out of the tree, mainly as we want to keep them in place for past branches ... Peter, I think I've covered all the files I need, and re-ran autoconf to make sure the configure file is in place properly ...
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/Makefile8
-rw-r--r--src/interfaces/libpq++/CHANGES32
-rw-r--r--src/interfaces/libpq++/Makefile67
-rw-r--r--src/interfaces/libpq++/README25
-rw-r--r--src/interfaces/libpq++/TODO4
-rw-r--r--src/interfaces/libpq++/examples/Makefile36
-rw-r--r--src/interfaces/libpq++/examples/testlibpq0.cc53
-rw-r--r--src/interfaces/libpq++/examples/testlibpq1.cc73
-rw-r--r--src/interfaces/libpq++/examples/testlibpq2.cc61
-rw-r--r--src/interfaces/libpq++/examples/testlibpq2.sql5
-rw-r--r--src/interfaces/libpq++/examples/testlibpq3.cc61
-rw-r--r--src/interfaces/libpq++/examples/testlibpq3.sql6
-rw-r--r--src/interfaces/libpq++/examples/testlibpq4.cc63
-rw-r--r--src/interfaces/libpq++/examples/testlibpq4.sql5
-rw-r--r--src/interfaces/libpq++/examples/testlibpq5.cc108
-rw-r--r--src/interfaces/libpq++/examples/testlibpq5.sql6
-rw-r--r--src/interfaces/libpq++/examples/testlibpq6.cc68
-rw-r--r--src/interfaces/libpq++/examples/testlo.cc52
-rw-r--r--src/interfaces/libpq++/libpq++.h36
-rw-r--r--src/interfaces/libpq++/libpq++dll.rc34
-rw-r--r--src/interfaces/libpq++/pgconnection.cc160
-rw-r--r--src/interfaces/libpq++/pgconnection.h106
-rw-r--r--src/interfaces/libpq++/pgcursordb.cc91
-rw-r--r--src/interfaces/libpq++/pgcursordb.h93
-rw-r--r--src/interfaces/libpq++/pgdatabase.cc181
-rw-r--r--src/interfaces/libpq++/pgdatabase.h91
-rw-r--r--src/interfaces/libpq++/pglobject.cc180
-rw-r--r--src/interfaces/libpq++/pglobject.h74
-rw-r--r--src/interfaces/libpq++/pgtransdb.cc54
-rw-r--r--src/interfaces/libpq++/pgtransdb.h64
-rw-r--r--src/interfaces/libpq++/win32.mak126
-rw-r--r--src/win32.mak4
32 files changed, 3 insertions, 2024 deletions
diff --git a/src/interfaces/Makefile b/src/interfaces/Makefile
index f90c80792cc..8fa11e0aff9 100644
--- a/src/interfaces/Makefile
+++ b/src/interfaces/Makefile
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.45 2001/03/09 21:50:27 petere Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.46 2002/08/22 00:15:10 scrappy Exp $
#
#-------------------------------------------------------------------------
@@ -14,16 +14,12 @@ include $(top_builddir)/src/Makefile.global
DIRS := libpq ecpg libpgeasy
-ALLDIRS := $(DIRS) odbc libpq++ libpgtcl perl5 python jdbc
+ALLDIRS := $(DIRS) odbc libpgtcl perl5 python jdbc
ifeq ($(enable_odbc), yes)
DIRS += odbc
endif
-ifeq ($(with_CXX), yes)
-DIRS += libpq++
-endif
-
ifeq ($(with_tcl), yes)
DIRS += libpgtcl
endif
diff --git a/src/interfaces/libpq++/CHANGES b/src/interfaces/libpq++/CHANGES
deleted file mode 100644
index 1f75e4d94a4..00000000000
--- a/src/interfaces/libpq++/CHANGES
+++ /dev/null
@@ -1,32 +0,0 @@
-
-5/18/1999 - vv
----------
-
-* Rewrote libpq++.h
-* Incremented shared library version to 3.0
-* Cleaned up makefiles
-* Made examples use the installed versions of the library and header
-
-
-4/26/1999 - vv
----------
-
-* Changed PrintTuples and DisplayTuples in PgDatabase to use PQprint()
-
-
-
-4/14/1999 - vv
----------
-
-* Changed connection routines to use PQconnectdb()
-* Connect now returns CONNECTION_OK or CONNECTION_BAD
-* Eliminated pgEnv
-* Changed error handler to return proper messages
-* New function LOid() returns Large Object ID
-* New function Status() returns Large Object Status
-
-
-
-
-
-
diff --git a/src/interfaces/libpq++/Makefile b/src/interfaces/libpq++/Makefile
deleted file mode 100644
index 8c89a16753d..00000000000
--- a/src/interfaces/libpq++/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile for libpq++ library
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.30 2001/05/22 11:24:28 momjian Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/interfaces/libpq++
-top_builddir = ../../..
-include $(top_builddir)/src/Makefile.global
-
-NAME= pq++
-SO_MAJOR_VERSION= 4
-SO_MINOR_VERSION= 0
-
-override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
-
-OBJS = pgconnection.o pgdatabase.o pgtransdb.o pgcursordb.o pglobject.o
-
-SHLIB_LINK= $(libpq)
-
-# communicate with Makefile.shlib
-cplusplus := yes
-
-
-all: all-lib
-
-# Shared library stuff
-include $(top_srcdir)/src/Makefile.shlib
-
-
-.PHONY: examples
-examples:
- $(MAKE) -C examples all
-
-install: all installdirs install-headers install-lib
-
-libpqxx_includedir = $(includedir)/libpq++
-MAINHEADER = libpq++.h
-LIBPGXXHEADERS = pgconnection.h pgdatabase.h pgtransdb.h pgcursordb.h pglobject.h
-
-.PHONY: install-headers
-install-headers: $(MAINHEADER) $(LIBPGXXHEADERS)
- $(INSTALL_DATA) $< $(DESTDIR)$(includedir)
- for i in $(LIBPGXXHEADERS); do $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(libpqxx_includedir) || exit 1; done
-
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(libpqxx_includedir)
-
-uninstall: uninstall-lib
- rm -f $(DESTDIR)$(includedir)/$(MAINHEADER)
- for i in $(LIBPGXXHEADERS); do rm -f $(DESTDIR)$(libpqxx_includedir)/$$i || exit; done
-
-clean distclean maintainer-clean: clean-lib
- rm -f $(OBJS)
- -$(MAKE) -C examples clean
-
-
-dep depend:
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) *.cc >depend
-
-ifeq (depend,$(wildcard depend))
-include depend
-endif
diff --git a/src/interfaces/libpq++/README b/src/interfaces/libpq++/README
deleted file mode 100644
index 810045b49bd..00000000000
--- a/src/interfaces/libpq++/README
+++ /dev/null
@@ -1,25 +0,0 @@
-Based on the original work by William Wanders (wwanders@sci.kun.nl)
-and Jolly Chen (jolly@cs.berkeley.edu), this is the first set of
-changes to libpq++ since ~1997. Pgenv has been removed, deprecated
-functions removed and/or updated and error handling rewritten,
-however for the most part it remains as a wrapper around libpq.
-The documentation on libpq is recommended reading to understand
-the function of libpq++.
-
-The API provided herein is subject to change in later versions of
-PostgreSQL.
-
-For details on how to to use libpq++, see Section 3 in Part 1 of
-the PostgreSQL Developer's Guide and the test programs in the
-examples/ subdirectory.
-
-** PgConnection has been changed to accept either the environment
-variables or conninfo style strings. See the PQconnectdb in the
-documentation on libpq for details.
-
-libpq++ has only been tested with g++, version 2.7.2.1
-
-Vince Vielhaber (vev@michvhf.com)
-Tue May 18 08:30:00 EDT 1999
-
-
diff --git a/src/interfaces/libpq++/TODO b/src/interfaces/libpq++/TODO
deleted file mode 100644
index 8f2ca7082a8..00000000000
--- a/src/interfaces/libpq++/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-
-* Implement exceptions
-* Many other things I have yet to discover
-
diff --git a/src/interfaces/libpq++/examples/Makefile b/src/interfaces/libpq++/examples/Makefile
deleted file mode 100644
index 5f4fa65f8bd..00000000000
--- a/src/interfaces/libpq++/examples/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile for libpq++ examples
-#
-# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-# Portions Copyright (c) 1994, Regents of the University of California
-#
-# $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/Makefile,v 1.15 2002/07/27 20:10:05 petere Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/interfaces/libpq++/examples
-top_builddir = ../../../..
-include $(top_builddir)/src/Makefile.global
-
-LIBNAME= libpq++
-HEADERDIR= $(includedir)
-LIBPQDIR= $(libdir)
-
-CXXFLAGS= $(CFLAGS)
-
-CXXFLAGS+= -I$(HEADERDIR)
-
-LDFLAGS+= -L$(LIBPQDIR) -lpq++
-
-PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
- testlibpq4 testlibpq5 testlibpq6 testlo
-
-all: $(PROGS)
-
-$(PROGS): % : %.cc
- $(CXX) $(CXXFLAGS) -o $@ $@.cc $(LDFLAGS)
-
-clean:
- rm -f $(PROGS)
-
diff --git a/src/interfaces/libpq++/examples/testlibpq0.cc b/src/interfaces/libpq++/examples/testlibpq0.cc
deleted file mode 100644
index 24fb03fc785..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq0.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* testlibpq0.c--
-* small test program for libpq++,
-* small interactive loop where queries can be entered interactively
-* and sent to the backend
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlibpq0.cc,v 1.7 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include <iostream.h>
-#include "libpq++.h"
-
-int main()
-{
- // Open the connection to the database and make sure it's OK
- PgDatabase data("dbname=template1");
- if ( data.ConnectionBad() )
- {
- cout << "Connection was unsuccessful..." << endl
- << "Error message returned: " << data.ErrorMessage() << endl;
- return 1;
- }
- else
- cout << "Connection successful... Enter queries below:" << endl;
-
- // Interactively obtain and execute queries
- ExecStatusType status;
- string buf;
- int done = 0;
- while (!done)
- {
- cout << "> ";
- cout.flush();
- getline(cin, buf);
- if ( buf != "" )
- if ( (status = data.Exec( buf.c_str() )) == PGRES_TUPLES_OK )
- data.DisplayTuples();
- else
- cout << "No tuples returned..." << endl
- << "status = " << status << endl
- << "Error returned: " << data.ErrorMessage() << endl;
- else
- done = 1;
- }
- return 0;
-} // End main()
diff --git a/src/interfaces/libpq++/examples/testlibpq1.cc b/src/interfaces/libpq++/examples/testlibpq1.cc
deleted file mode 100644
index f6469b8a3a1..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq1.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* testlibpq1.cc
-* Test the C++ version of LIBPQ, the POSTGRES frontend library.
-*
-* queries the template1 database for a list of database names
-*
-*/
-
-#include <iostream.h>
-#include <iomanip.h>
-#include "libpq++.h"
-
-int main()
-{
- // Begin, by establishing a connection to the backend.
- // When no parameters are given then the system will
- // try to use reasonable defaults by looking up environment variables
- // or, failing that, using hardwired constants
- const char* dbName = "dbname=template1";
- PgDatabase data(dbName);
-
- // check to see that the backend connection was successfully made
- if ( data.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << "Error returned: " << data.ErrorMessage() << endl;
- exit(1);
- }
-
- // start a transaction block
- if ( !data.ExecCommandOk("BEGIN") )
- {
- cerr << "BEGIN command failed" << endl;
- exit(1);
- }
-
- // submit command to the backend
- if ( !data.ExecCommandOk("DECLARE myportal CURSOR FOR select * from pg_database") )
- {
- cerr << "DECLARE CURSOR command failed" << endl;
- exit(1);
- }
-
- // fetch instances from the pg_database, the system catalog of databases
- if ( !data.ExecTuplesOk("FETCH ALL in myportal") )
- {
- cerr << "FETCH ALL command didn't return tuples properly" << endl;
- exit(1);
- }
-
- // first, print out the attribute names
- int nFields = data.Fields();
- for (int i = 0; i < nFields; i++)
- cout << setiosflags(ios::right) << setw(15) << data.FieldName(i);
- cout << endl << endl;
-
- // next, print out the instances
- for (int i = 0; i < data.Tuples(); i++)
- {
- for (int j = 0; j < nFields; j++)
- cout << setiosflags(ios::right) << setw(15) << data.GetValue(i, j);
- cout << endl;
- }
-
- // Close the portal
- data.Exec("CLOSE myportal");
-
- // End the transaction
- data.Exec("END");
- return 0;
-}
-
-
diff --git a/src/interfaces/libpq++/examples/testlibpq2.cc b/src/interfaces/libpq++/examples/testlibpq2.cc
deleted file mode 100644
index 9bad37e3cdf..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq2.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* testlibpq2.cc
-* Test the C++ version of LIBPQ, the POSTGRES frontend library.
-*
-* queries the template1 database for a list of database names using transaction block
-*
-*/
-
-#include <iostream.h>
-#include <iomanip.h>
-#include "libpq++.h"
-
-int main()
-{
- // Begin, by establishing a connection to the backend.
- // When no parameters are given then the system will
- // try to use reasonable defaults by looking up environment variables
- // or, failing that, using hardwired constants
- const char* dbName = "dbname=template1";
- PgTransaction data(dbName);
-
- // check to see that the backend connection was successfully made
- if ( data.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << "Error returned: " << data.ErrorMessage() << endl;
- exit(1);
- }
-
- // submit command to the backend
- if ( !data.ExecCommandOk("DECLARE myportal CURSOR FOR select * from pg_database") )
- {
- cerr << "DECLARE CURSOR command failed" << endl;
- exit(1);
- }
-
- // fetch instances from the pg_database, the system catalog of databases
- if ( !data.ExecTuplesOk("FETCH ALL in myportal") )
- {
- cerr << "FETCH ALL command didn't return tuples properly" << endl;
- exit(1);
- }
-
- // first, print out the attribute names
- int nFields = data.Fields();
- for (int i = 0; i < nFields; i++)
- cout << setiosflags(ios::right) << setw(15) << data.FieldName(i);
- cout << endl << endl;
-
- // next, print out the instances
- for (int i = 0; i < data.Tuples(); i++)
- {
- for (int j = 0; j < nFields; j++)
- cout << setiosflags(ios::right) << setw(15) << data.GetValue(i, j);
- cout << endl;
- }
-
- // close the portal
- data.Exec("CLOSE myportal");
- return 0;
-}
diff --git a/src/interfaces/libpq++/examples/testlibpq2.sql b/src/interfaces/libpq++/examples/testlibpq2.sql
deleted file mode 100644
index f9c74109328..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq2.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE TBL1 (i int4);
-
-CREATE TABLE TBL2 (i int4);
-
-CREATE RULE r1 AS ON INSERT TO TBL1 DO [INSERT INTO TBL2 values (new.i); NOTIFY TBL2];
diff --git a/src/interfaces/libpq++/examples/testlibpq3.cc b/src/interfaces/libpq++/examples/testlibpq3.cc
deleted file mode 100644
index fa2625f5b28..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq3.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* testlibpq3.cc
-* Test the C++ version of LIBPQ, the POSTGRES frontend library.
-*
-* queries the template1 database for a list of database names using transaction block
-* and cursor interface.
-*
-*/
-
-#include <iostream.h>
-#include <iomanip.h>
-#include "libpq++.h"
-
-int main()
-{
- // Begin, by establishing a connection to the backend.
- // When no parameters are given then the system will
- // try to use reasonable defaults by looking up environment variables
- // or, failing that, using hardwired constants.
- // Create a cursor database query object.
- // All queries using cursor will be performed through this object.
- const char* dbName = "dbname=template1";
- PgCursor cData(dbName, "myportal");
-
- // check to see that the backend connection was successfully made
- if ( cData.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << "Error returned: " << cData.ErrorMessage() << endl;
- exit(1);
- }
-
- // submit command to the backend
- if ( !cData.Declare("select * from pg_database") )
- {
- cerr << "DECLARE CURSOR command failed" << endl;
- exit(1);
- }
-
- // fetch instances from the pg_cDatabase, the system catalog of cDatabases
- if ( !cData.Fetch() )
- {
- cerr << "FETCH ALL command didn't return tuples properly" << endl;
- exit(1);
- }
-
- // first, print out the attribute names
- int nFields = cData.Fields();
- for (int i = 0; i < nFields; i++)
- cout << setiosflags(ios::right) << setw(15) << cData.FieldName(i);
- cout << endl << endl;
-
- // next, print out the instances
- for (int i = 0; i < cData.Tuples(); i++)
- {
- for (int j = 0; j < nFields; j++)
- cout << setiosflags(ios::right) << setw(15) << cData.GetValue(i, j);
- cout << endl;
- }
- return 0;
-}
diff --git a/src/interfaces/libpq++/examples/testlibpq3.sql b/src/interfaces/libpq++/examples/testlibpq3.sql
deleted file mode 100644
index f024c0b071b..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq3.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE test1 (i int4, d float4, p polygon);
-
-INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
-
-INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);
-
diff --git a/src/interfaces/libpq++/examples/testlibpq4.cc b/src/interfaces/libpq++/examples/testlibpq4.cc
deleted file mode 100644
index 6be620e0736..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq4.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* testlibpq4.cc
-* Test of the asynchronous notification interface
-*
- populate a test database with the following (use testlibpq4.sql):
-
-CREATE TABLE TBL1 (i int4);
-
-CREATE TABLE TBL2 (i int4);
-
-CREATE RULE r1 AS ON INSERT TO TBL1 DO [INSERT INTO TBL2 values (new.i); NOTIFY TBL2];
-
-* Then start up this program
-* After the program has begun, do
-
-INSERT INTO TBL1 values (10);
-
-*
-*
-*/
-#include <iostream.h>
-#include "libpq++.h"
-#include <stdlib.h>
-
-int main()
-{
- // Begin, by connecting to the backend using hardwired constants
- // and a test database created by the user prior to the invokation
- // of this test program.
- const char* dbName = "dbname=template1";
- PgDatabase data(dbName);
-
- // Check to see that the backend connection was successfully made
- if ( data.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << data.ErrorMessage() << endl;
- exit(1);
- }
-
- // Listen to a table
- if ( !data.ExecCommandOk("LISTEN TBL2") )
- {
- cerr << "LISTEN command failed" << endl;
- exit(1);
- }
-
- // Test asynchronous notification
- while (1)
- {
- // check for asynchronous returns
- PGnotify* notify = data.Notifies();
- if (notify)
- {
- cerr << "ASYNC NOTIFY of '" << notify->relname
- << "' from backend pid '" << notify->be_pid
- << "' received" << endl;
- free(notify);
- break;
- }
- }
- return 0;
-}
diff --git a/src/interfaces/libpq++/examples/testlibpq4.sql b/src/interfaces/libpq++/examples/testlibpq4.sql
deleted file mode 100644
index 53d3fdfffad..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq4.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE TBL1 (i int4);
-
-CREATE TABLE TBL2 (i int4);
-
-CREATE RULE r1 AS ON INSERT TO TBL1 DO (INSERT INTO TBL2 values (new.i); NOTIFY TBL2);
diff --git a/src/interfaces/libpq++/examples/testlibpq5.cc b/src/interfaces/libpq++/examples/testlibpq5.cc
deleted file mode 100644
index 086a598cc7c..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq5.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* testlibpq5.cc
-* Test the C++ version of LIBPQ, the POSTGRES frontend library.
-* tests the binary cursor interface
-*
-*
-*
-populate a database by doing the following (use testlibpq5.sql):
-
-CREATE TABLE test1 (i int4, d float4, p polygon);
-
-INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
-
-INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);
-
-the expected output is:
-
-tuple 0: got
-i = (4 bytes) 1,
-d = (4 bytes) 3.567000,
-p = (4 bytes) 2 points boundbox = (hi=3.000000/4.000000, lo = 1.000000,2.000000)
-tuple 1: got
-i = (4 bytes) 2,
-d = (4 bytes) 89.050003,
-p = (4 bytes) 2 points boundbox = (hi=4.000000/3.000000, lo = 2.000000,1.000000)
-
-*
-*/
-#include <iostream.h>
-#include "libpq++.h"
-#include <stdlib.h>
-extern "C"
-{
-#include "postgres.h" // for Postgres types
-#include "utils/geo_decls.h" // for the POLYGON type
-}
-
-int main()
-{
- // Begin, by connecting to the backend using hardwired constants
- // and a test database created by the user prior to the invokation
- // of this test program. Connect using cursor interface.
- const char* dbName = "dbname=template1"; // change this to the name of your test database
- PgCursor data(dbName, "mycursor");
-
- // check to see that the backend connection was successfully made
- if ( data.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << data.ErrorMessage();
- exit(1);
- }
-
- // Declare a binary cursor for all the tuples in database 'test1'
- if ( !data.Declare("select * from test1", 1) )
- {
- cerr << "DECLARE CURSOR command failed" << endl;
- exit(1);
- }
-
- // fetch all instances from the current cursor
- if ( !data.Fetch() )
- {
- cerr << "FETCH ALL command didn't return tuples properly" << endl;
- exit(1);
- }
-
- // Find the field numbers for the columns 'i', 'd', and 'p'
- int i_fnum = data.FieldNum("i");
- int d_fnum = data.FieldNum("d");
- int p_fnum = data.FieldNum("p");
-
- /*
- for (i=0;i<3;i++) {
- printf("type[%d] = %d, size[%d] = %d\n",
- i, data.FieldType(i),
- i, data.FieldSize(i));
- }
- */
-
- // Print out the information about the extracted tuple
- for (int i = 0; i < data.Tuples(); i++)
- {
- // we hard-wire this to the 3 fields we know about
- int* ival = (int*)data.GetValue(i, i_fnum);
- float* dval = (float*)data.GetValue(i, d_fnum);
- int plen = data.GetLength(i, p_fnum);
-
- // Allocate correct memory space for the Polygon struct and copy
- // the extracted data into it.
- // plen doesn't include the length field so need to increment by VARHDSZ
- POLYGON* pval = (POLYGON*) malloc(plen + VARHDRSZ);
- pval->size = plen;
- memmove((char*)&pval->npts, data.GetValue(i, p_fnum), plen);
-
- // Display Polygon Information
- cout << "tuple " << i << ": got" << endl
- << " i = (" << data.GetLength(i, i_fnum) << " bytes) " << *ival << "," << endl
- << " d = (" << data.GetLength(i, d_fnum) << " bytes) " << *dval << "," << endl
- << " p = (" << data.GetLength(i, d_fnum) << " bytes) " << pval->npts << " points"
- << "\tboundbox = (hi=" << pval->boundbox.high.x << "/" << pval->boundbox.high.y << ","
- << "lo = " << pval->boundbox.low.x << "," << pval->boundbox.low.y << ")" << endl;
-
- // Deallocate memory allocated for the Polygon structure
- free(pval);
- }
- return 0;
-}
diff --git a/src/interfaces/libpq++/examples/testlibpq5.sql b/src/interfaces/libpq++/examples/testlibpq5.sql
deleted file mode 100644
index f024c0b071b..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq5.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE test1 (i int4, d float4, p polygon);
-
-INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
-
-INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);
-
diff --git a/src/interfaces/libpq++/examples/testlibpq6.cc b/src/interfaces/libpq++/examples/testlibpq6.cc
deleted file mode 100644
index 29b84c0cbe2..00000000000
--- a/src/interfaces/libpq++/examples/testlibpq6.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* testlibpq4.cc
-* Test the C++ version of LIBPQ, the POSTGRES frontend library.
-* tests the copy in features
-*
-*/
-#include <iostream.h>
-#include "libpq++.h"
-#include <stdlib.h>
-
-int main()
-{
- // Begin, by connecting to the backend using hardwired constants
- // and a test database created by the user prior to the invokation
- // of this test program. Connect using transaction interface.
- const char* dbName = "dbname=template1";
- PgTransaction data(dbName);
-
- // check to see that the backend connection was successfully made
- if ( data.ConnectionBad() )
- {
- cerr << "Connection to database '" << dbName << "' failed." << endl
- << data.ErrorMessage();
- exit(1);
- }
- else
- cout << "Connected to database '" << dbName << "'..." << endl;
-
- // Create a new table
- if ( !data.ExecCommandOk("CREATE TABLE foo (a int4, b char(16), d float8)") )
- {
- cerr << "CREATE TABLE foo command failed" << endl;
- exit(1);
- }
- else
- cout << "CREATEd TABLE foo successfully.." << endl;
-
- // Initiate Copy command
- if ( data.ExecCommandOk("COPY foo FROM STDIN") )
- {
- cerr << "COPY foo FROM STDIN" << endl;
- exit(1);
- }
- else
- cout << "COPY foo FROM STDIN was successful.." << endl;
-
- // Put some test data into the table
- data.PutLine("3\thello world\t4.5\n");
- cout << "Line: \"3\thello world\t4.5\" copied..." << endl;
- data.PutLine("4\tgoodbye word\t7.11\n");
- cout << "Line: \"4\tgoodbye word\t7.11\" copied..." << endl;
- data.PutLine("\\.\n");
- cout << "Line: \"\\.\" copied..." << endl;
- if ( !data.EndCopy() )
- cout << "Ended COPY succesfully..." << endl;
- else
- cerr << "End Copy failed..." << endl;
-
- // Print the data that was inserted into the table
- if ( data.ExecTuplesOk("SELECT * FROM foo") )
- data.PrintTuples();
- else
- cerr << "SELECT * FROM foo failed..." << endl;
-
- // Drop the test table
- data.Exec("DROP TABLE foo");
- return 0;
-}
diff --git a/src/interfaces/libpq++/examples/testlo.cc b/src/interfaces/libpq++/examples/testlo.cc
deleted file mode 100644
index 04ea8071dc0..00000000000
--- a/src/interfaces/libpq++/examples/testlo.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* lotest.cc--
-* test using large objects with libpq
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlo.cc,v 1.9 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-#include <iostream.h>
-#include "libpq++.h"
-#include <stdlib.h>
-
-int main(int argc, char **argv)
-{
- // Check if the program was invoked correctly; if not, signal error
- if (argc < 4 || argc > 5)
- {
- cerr << "Usage: " << argv[0] << " conninfo_str in_filename out_filename [oid]" << endl;
- exit(1);
- }
-
- // Get the arguments passed to the program
- char* conninfo = argv[1];
- char* in_filename = argv[2];
- char* out_filename = argv[3];
-
- // Set up the connection and create a large object
- int lobjId = ( argc == 4 ? 0 : atoi(argv[4]) );
- PgLargeObject object(lobjId, conninfo);
-
- // check to see that the backend connection was successfully made
- if ( object.ConnectionBad() )
- {
- cerr << "Connection with conninfo '" << conninfo << "' failed." << endl
- << object.ErrorMessage();
- exit(1);
- }
-
- // Test the import and export features of the Large Object interface
- object.Exec("BEGIN");
- cout << "Importing file \"" << in_filename << "\"..." << endl;
- object.Import(in_filename);
- cout << "Exporting large object to file \"" << out_filename << "\"..." << endl;
- object.Export(out_filename);
- object.Exec("END"); // WHY DOES IT CORE DUMP HERE ???
- return 0;
-}
diff --git a/src/interfaces/libpq++/libpq++.h b/src/interfaces/libpq++/libpq++.h
deleted file mode 100644
index b8c7945e586..00000000000
--- a/src/interfaces/libpq++/libpq++.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* libpq++.h
-*
-*
-* DESCRIPTION
-* C++ client interface to Postgres
-* used for building front-end applications
-*
-* NOTES
-* This is intended to be included by client applications.
-* It will not work as an inclusion in the libpq++ sources, since
-* in the build environment the individual include files are not
-* yet installed in a subdirectory.
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-* $Id: libpq++.h,v 1.13 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-
-#ifndef LIBPQXX_H
-#define LIBPQXX_H
-
-#include <string.h>
-
-#include "libpq++/pgconnection.h"
-#include "libpq++/pgdatabase.h"
-#include "libpq++/pglobject.h"
-#include "libpq++/pgtransdb.h"
-#include "libpq++/pgcursordb.h"
-
-#endif /* LIBPQXX_H */
diff --git a/src/interfaces/libpq++/libpq++dll.rc b/src/interfaces/libpq++/libpq++dll.rc
deleted file mode 100644
index dcd411c41b4..00000000000
--- a/src/interfaces/libpq++/libpq++dll.rc
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <winver.h>
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 7,2,0,0
- PRODUCTVERSION 7,2,0,0
- FILEFLAGSMASK 0x3fL
- FILEFLAGS 0x0L
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", " \0"
- VALUE "FileDescription", "PostgreSQL C++ Access Library\0"
- VALUE "FileVersion", "7, 2, 0, 0\0"
- VALUE "InternalName", "libpq++\0"
- VALUE "LegalCopyright", "Copyright © 2000\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "libpq++.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PostgreSQL\0"
- VALUE "ProductVersion", "7, 2, 0, 0\0"
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
diff --git a/src/interfaces/libpq++/pgconnection.cc b/src/interfaces/libpq++/pgconnection.cc
deleted file mode 100644
index 5b61ff636a0..00000000000
--- a/src/interfaces/libpq++/pgconnection.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pgconnection.cc
-*
-* DESCRIPTION
-* implementation of the PgConnection class.
-* PgConnection encapsulates a frontend to backend connection
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.15 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include "pgconnection.h"
-
-#ifdef HAVE_NAMESPACE_STD
-using namespace std;
-#endif
-
-// ****************************************************************
-//
-// PgConnection Implementation
-//
-// ****************************************************************
-// default constructor -- initialize everything
-PgConnection::PgConnection()
- : pgConn(NULL), pgResult(NULL), pgCloseConnection(false)
-{}
-
-
-// constructor -- checks environment variable for database name
-// Now uses PQconnectdb
-
-PgConnection::PgConnection(const char* conninfo)
- : pgConn(NULL), pgResult(NULL), pgCloseConnection(true)
-{
- // Connect to the database
- Connect(conninfo);
-}
-
-
-// destructor - closes down the connection and cleanup
-PgConnection::~PgConnection()
-{
- // Close the connection only if needed
- // This feature will most probably be used by the derived classes that
- // need not close the connection after they are destructed.
- CloseConnection();
-}
-
-
-// PgConnection::CloseConnection()
-// close down the connection if there is one
-void PgConnection::CloseConnection()
-{
- // if the connection is open, close it first
- if (pgCloseConnection)
- {
- if (pgResult)
- PQclear(pgResult);
- pgResult = NULL;
- if (pgConn)
- PQfinish(pgConn);
- pgConn = NULL;
- pgCloseConnection = false;
- }
-}
-
-
-// PgConnection::connect
-// establish a connection to a backend
-ConnStatusType PgConnection::Connect(const char conninfo[])
-{
- // if the connection is open, close it first
- CloseConnection();
-
- // Connect to the database
- pgConn = PQconnectdb(conninfo);
-
- // Now we have a connection we must close (even if it's bad!)
- pgCloseConnection = true;
-
- // Status will return either CONNECTION_OK or CONNECTION_BAD
- return Status();
-}
-
-// PgConnection::status -- return connection or result status
-ConnStatusType PgConnection::Status() const
-{
- return PQstatus(pgConn);
-}
-
-// PgConnection::exec -- send a query to the backend
-ExecStatusType PgConnection::Exec(const char* query)
-{
- // Clear the result stucture if needed
- if (pgResult)
- PQclear(pgResult);
-
- // Execute the given query
- pgResult = PQexec(pgConn, query);
-
- // Return the status
- if (pgResult)
- return PQresultStatus(pgResult);
- else
- return PGRES_FATAL_ERROR;
-}
-
-// Return true if the Postgres command was executed OK
-int PgConnection::ExecCommandOk(const char* query)
-{
- return Exec(query) == PGRES_COMMAND_OK;
-}
-
-int PgConnection::ExecTuplesOk(const char* query)
-{
- return Exec(query) == PGRES_TUPLES_OK;
-}
-
-// Don't know why these next two need to be part of Connection
-
-// PgConnection::notifies() -- returns a notification from a list of unhandled notifications
-PGnotify* PgConnection::Notifies()
-{
- return PQnotifies(pgConn);
-}
-
-// From Integer To String Conversion Function
-string PgConnection::IntToString(int n)
-{
- char buffer [4*sizeof(n) + 2];
- sprintf(buffer, "%d", n);
- return buffer;
-}
-
-bool PgConnection::ConnectionBad() const
-{
- return Status() == CONNECTION_BAD;
-}
-
-const char* PgConnection::ErrorMessage() const
-{
- return (const char *)PQerrorMessage(pgConn);
-}
-
-const char* PgConnection::DBName() const
-{
- return (const char *)PQdb(pgConn);
-}
-
-PQnoticeProcessor PgConnection::SetNoticeProcessor(PQnoticeProcessor proc, void *arg)
-{
- return PQsetNoticeProcessor(pgConn, proc, arg);
-}
-
diff --git a/src/interfaces/libpq++/pgconnection.h b/src/interfaces/libpq++/pgconnection.h
deleted file mode 100644
index 01878cdde16..00000000000
--- a/src/interfaces/libpq++/pgconnection.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* pgconnection.h
-*
-*
-* DESCRIPTION
-* Postgres Connection Class:
-* Manage Postgres backend connection
-*
-* NOTES
-* Currently under construction.
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-* $Id: pgconnection.h,v 1.19 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#ifndef PGCONNECTION_H
-#define PGCONNECTION_H
-
-extern "C"
-{
-#include "pg_config.h"
-}
-
-/* We assume that the C++ compiler will have these keywords, even though
- * pg_config.h may have #define'd them to empty because the C compiler doesn't.
- */
-#undef const
-#undef inline
-#undef signed
-#undef volatile
-
-#ifdef HAVE_CXX_STRING_HEADER
-#include <string>
-#endif
-
-extern "C"
-{
-#include "libpq-fe.h"
-}
-
-#ifdef HAVE_NAMESPACE_STD
-#define PGSTD std::
-#else
-#define PGSTD
-#endif
-
-
-// ****************************************************************
-//
-// PgConnection - a connection made to a postgres backend
-//
-// ****************************************************************
-// This class contains all the information about the connection
-// to the backend process. All the database classes should be
-// derived from this class to obtain the connection interface.
-class DLLIMPORT PgConnection
-{
-protected:
- PGconn* pgConn; // Connection Structure
- PGresult* pgResult; // Current Query Result
- bool pgCloseConnection; // true if connection should be closed by destructor
-
-public:
- explicit PgConnection(const char* conninfo); // use reasonable & environment defaults
- virtual ~PgConnection(); // close connection and clean up
-
- // Connection status and error messages
- ConnStatusType Status() const;
- bool ConnectionBad() const;
- const char* ErrorMessage() const;
-
- // returns the database name of the connection
- const char* DBName() const;
-
- // Query Execution interface
- ExecStatusType Exec(const char* query); // send a query to the backend
- int ExecCommandOk(const char* query); // send a command and check if it's OK
- int ExecTuplesOk(const char* query); // send a command and check if tuples are returned
- PGnotify* Notifies();
-
- // set the notice processor
- PQnoticeProcessor SetNoticeProcessor(PQnoticeProcessor proc, void *arg);
-
-protected:
- ConnStatusType Connect(const char* conninfo);
- void CloseConnection();
- static PGSTD string IntToString(int);
- // Default constructor is only available to subclasses
- PgConnection();
-
-private:
- // We don't support copying of PgConnection objects,
- // so make copy constructor and assignment op private.
- PgConnection(const PgConnection&);
- PgConnection& operator= (const PgConnection&);
-};
-
-
-#undef PGSTD
-
-#endif // PGCONNECTION_H
diff --git a/src/interfaces/libpq++/pgcursordb.cc b/src/interfaces/libpq++/pgcursordb.cc
deleted file mode 100644
index 182911817a1..00000000000
--- a/src/interfaces/libpq++/pgcursordb.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pgcursordb.cpp
-*
-* DESCRIPTION
-* implementation of the PgCursor class.
-* PgCursor encapsulates a cursor interface to the backend
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.8 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include "pgcursordb.h"
-
-#ifdef HAVE_NAMESPACE_STD
-using namespace std;
-#endif
-
-
-// ****************************************************************
-//
-// PgCursor Implementation
-//
-// ****************************************************************
-// Make a connection to the specified database with default environment
-// See PQconnectdb() for conninfo usage
-PgCursor::PgCursor(const char* conninfo, const char* cursor)
- : PgTransaction(conninfo), pgCursor(cursor)
-{}
-
-// Do not make a connection to the backend -- just query
-// Connection should not be closed after the object destructs since some
-// other object is using the connection
-//PgCursor::PgCursor(const PgConnection& conn, const char* cursor)
-// : PgTransaction(conn), pgCursor(cursor)
-//{}
-
-// Destructor: End the transaction block
-
-PgCursor::~PgCursor()
-{
- Close();
-}
-
-
-// ****************************************************************
-//
-// PgCursor: Cursor Interface Implementation
-//
-// ****************************************************************
-// Declare a cursor: name has already been supplied in the constructor
-int PgCursor::Declare(string query, bool binary)
-{
- string cmd = "DECLARE " + pgCursor;
- if ( binary )
- cmd += " BINARY";
- cmd += " CURSOR FOR " + query;
- return ExecCommandOk( cmd.c_str() );
-}
-
-// Fetch ALL tuples in given direction
-int PgCursor::Fetch(const char* dir)
-{
- return Fetch("ALL", dir);
-}
-
-// Fetch specified amount of tuples in given direction
-int PgCursor::Fetch(unsigned num, const char* dir)
-{
- return Fetch( IntToString(num), dir );
-}
-
-// Create and execute the actual fetch command with the given arguments
-int PgCursor::Fetch(string num, string dir)
-{
- string cmd = "FETCH " + dir + " " + num + " IN " + pgCursor;
- return ExecTuplesOk( cmd.c_str() );
-}
-
-// Close the cursor: no more queries using the cursor should be allowed
-// Actually, the backend should take care of it.
-int PgCursor::Close()
-{
- string cmd = "CLOSE " + pgCursor;
- return ExecCommandOk( cmd.c_str() );
-}
diff --git a/src/interfaces/libpq++/pgcursordb.h b/src/interfaces/libpq++/pgcursordb.h
deleted file mode 100644
index 7f11ce5d1c9..00000000000
--- a/src/interfaces/libpq++/pgcursordb.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* pgcursordb.h
-*
-*
-* DESCRIPTION
-* Postgres Cursor Database Class:
-* Query Postgres backend using a cursor
-*
-* NOTES
-* Currently under construction.
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-*
-* $Id: pgcursordb.h,v 1.12 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#ifndef PGCURSORDB_H
-#define PGCURSORDB_H
-
-#ifndef PGTRANSDB_H
-#include "pgtransdb.h"
-#endif
-
-#ifdef HAVE_NAMESPACE_STD
-#define PGSTD std::
-#else
-#define PGSTD
-#endif
-
-// ****************************************************************
-//
-// PgCursor - a class for querying databases using a cursor
-//
-// ****************************************************************
-// This is the database access class that declares a cursor and
-// manipulates data through it. The interface will introduce some
-// ease of use through the methods that will allow cursor specific
-// operations, like fetch, forward, etc.
-class DLLIMPORT PgCursor : public PgTransaction
-{
-public:
- PgCursor(const char* conninfo, const char* cursor); // use reasonable & environment defaults
- // connect to the database with given environment and database name
- // PgCursor(const PgConnection&, const char* cursor);
- ~PgCursor(); // close connection and clean up
-
- // Commands associated with cursor interface
- int Declare(PGSTD string query, bool binary = false); // Declare a cursor with given name
- int Fetch(const char* dir = "FORWARD"); // Fetch ALL tuples in given direction
- int Fetch(unsigned num, const char* dir = "FORWARD"); // Fetch specified amount of tuples
- int Close(); // Close the cursor
-
- // Accessors to the cursor name
- const char* Cursor() const
- {
- return pgCursor.c_str();
- }
- // TODO: Setter has same name as getter--ouch!
- // OBSOLESCENT
- void Cursor(PGSTD string cursor)
- {
- pgCursor = cursor;
- }
-
-protected:
- int Fetch(PGSTD string num, PGSTD string dir);
-
-protected:
- PGSTD string pgCursor;
-
-protected:
- PgCursor() : PgTransaction()
- {} // Do not connect
-
-
-private:
- // We don't support copying of PgCursor objects,
- // so make copy constructor and assignment op private.
- PgCursor(const PgCursor&);
- PgCursor& operator= (const PgCursor&);
-}
-; // End PgCursor Class Declaration
-
-
-#undef PGSTD
-
-#endif // PGCURSORDB_H
-
diff --git a/src/interfaces/libpq++/pgdatabase.cc b/src/interfaces/libpq++/pgdatabase.cc
deleted file mode 100644
index 6d8cd82c541..00000000000
--- a/src/interfaces/libpq++/pgdatabase.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pgdatabase.cpp
-*
-* DESCRIPTION
-* implementation of the PgDatabase class.
-* PgDatabase encapsulates some utility routines
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.13 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include "pgdatabase.h"
-
-#ifdef HAVE_NAMESPACE_STD
-using namespace std;
-#endif
-
-
-// OBSOLESCENT (uses PQprint(), which is no longer being maintained)
-void PgDatabase::DisplayTuples(FILE *out,
- bool fillAlign,
- const char* fieldSep,
- bool printHeader,
- bool /* quiet */) const
-{
- PQprintOpt po;
-
- po.header = printHeader;
- po.align = fillAlign;
- po.standard = po.html3 = po.expanded = po.pager = 0;
- po.fieldSep = (char *) (fieldSep);
- po.tableOpt = po.caption = 0;
- po.fieldName = 0;
-
- PQprint(out, pgResult, &po);
-}
-
-
-
-// OBSOLESCENT (uses PQprint(), which is no longer being maintained)
-void PgDatabase::PrintTuples(FILE *out,
- bool printAttName,
- bool terseOutput,
- bool fillAlign) const
-{
- PQprintOpt po;
-
- po.header = printAttName;
- po.align = fillAlign;
- po.standard = po.html3 = po.expanded = po.pager = 0;
- po.tableOpt = po.caption = 0;
- po.fieldSep = (char *) (terseOutput ? "" : "|");
- po.fieldName = 0;
-
- PQprint(out, pgResult, &po);
-}
-
-
-
-int PgDatabase::Tuples() const
-{
- return PQntuples(pgResult);
-}
-
-
-int PgDatabase::CmdTuples() const
-{
- const char *a = PQcmdTuples(pgResult);
- return a[0] ? atoi(a) : -1;
-}
-
-
-// TODO: Make const?
-int PgDatabase::Fields()
-{
- return PQnfields(pgResult);
-}
-
-
-const char* PgDatabase::FieldName(int field_num) const
-{
- return PQfname(pgResult, field_num);
-}
-
-
-int PgDatabase::FieldNum(const char* field_name) const
-{
- return PQfnumber(pgResult, field_name);
-}
-
-
-Oid PgDatabase::FieldType(int field_num) const
-{
- return PQftype(pgResult, field_num);
-}
-
-
-Oid PgDatabase::FieldType(const char* field_name) const
-{
- return PQftype(pgResult, FieldNum(field_name));
-}
-
-
-int PgDatabase::FieldSize(int field_num) const
-{
- return PQfsize(pgResult, field_num);
-}
-
-
-int PgDatabase::FieldSize(const char* field_name) const
-{
- return PQfsize(pgResult, FieldNum(field_name));
-}
-
-
-const char* PgDatabase::GetValue(int tup_num, int field_num) const
-{
- return PQgetvalue(pgResult, tup_num, field_num);
-}
-
-
-const char* PgDatabase::GetValue(int tup_num, const char* field_name) const
-{
- return PQgetvalue(pgResult, tup_num, FieldNum(field_name));
-}
-
-
-bool PgDatabase::GetIsNull(int tup_num, int field_num) const
-{
- return PQgetisnull(pgResult, tup_num, field_num);
-}
-
-
-bool PgDatabase::GetIsNull(int tup_num, const char* field_name) const
-{
- return PQgetisnull(pgResult, tup_num, FieldNum(field_name));
-}
-
-
-int PgDatabase::GetLength(int tup_num, int field_num) const
-{
- return PQgetlength(pgResult, tup_num, field_num);
-}
-
-
-int PgDatabase::GetLength(int tup_num, const char* field_name) const
-{
- return PQgetlength(pgResult, tup_num, FieldNum(field_name));
-}
-
-
-int PgDatabase::GetLine(char str[], int length)
-{
- return PQgetline(pgConn, str, length);
-}
-
-
-void PgDatabase::PutLine(const char str[])
-{
- PQputline(pgConn, str);
-}
-
-
-const char* PgDatabase::OidStatus() const
-{
- return PQoidStatus(pgResult);
-}
-
-
-int PgDatabase::EndCopy()
-{
- return PQendcopy(pgConn);
-}
-
-
diff --git a/src/interfaces/libpq++/pgdatabase.h b/src/interfaces/libpq++/pgdatabase.h
deleted file mode 100644
index e1e3c34f619..00000000000
--- a/src/interfaces/libpq++/pgdatabase.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* pgdatabase.h
-*
-*
-* DESCRIPTION
-* Postgres Database Class:
-* Query Postgres backend to obtain query results
-*
-* NOTES
-* Currently under construction.
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-*
-* $Id: pgdatabase.h,v 1.14 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#ifndef PGDATABASE_H
-#define PGDATABASE_H
-
-#ifndef PGCONNECTION_H
-#include "pgconnection.h"
-#endif
-
-// ****************************************************************
-//
-// PgDatabase - a class for accessing databases
-//
-// ****************************************************************
-// This is the basic database access class. Its interface should
-// be used only after a query has been sent to the backend and
-// results are being received.
-class DLLIMPORT PgDatabase : public PgConnection
-{
-public:
- // connect to the database with conninfo
- explicit PgDatabase(const char* conninfo) : PgConnection(conninfo)
- {}
-
- ~PgDatabase()
- {} // close connection and clean up
-
-
- typedef int size_type;
-
- // query result access
- size_type Tuples() const;
- size_type CmdTuples() const;
- int Fields();
- const char* FieldName(int field_num) const;
- int FieldNum(const char* field_name) const;
- Oid FieldType(int field_num) const;
- Oid FieldType(const char* field_name) const;
- int FieldSize(int field_num) const;
- int FieldSize(const char* field_name) const;
- const char* GetValue(size_type tup_num, int field_num) const;
- const char* GetValue(size_type tup_num, const char* field_name) const;
- bool GetIsNull(size_type tup_num, int field_num) const;
- bool GetIsNull(size_type tup_num, const char* field_name) const;
- int GetLength(size_type tup_num, int field_num) const;
- int GetLength(size_type tup_num, const char* field_name) const;
-
- // OBSOLESCENT (use PQprint()):
- void DisplayTuples(FILE *out = 0, bool fillAlign = true,
- const char* fieldSep = "|", bool printHeader = true, bool quiet = false) const;
- void PrintTuples(FILE *out = 0, bool printAttName = true,
- bool terseOutput = false, bool fillAlign = false) const;
-
- // copy command related access
- int GetLine(char str[], int length);
- void PutLine(const char str[]);
- const char* OidStatus() const;
- int EndCopy();
-
-protected:
- PgDatabase() : PgConnection()
- {} // Do not connect
-
-
-private:
- // We don't support copying of PgDatabase objects,
- // so make copy constructor and assignment op private.
- PgDatabase(const PgDatabase&);
- PgDatabase& operator= (const PgDatabase&);
-};
-
-#endif // PGDATABASE_H
diff --git a/src/interfaces/libpq++/pglobject.cc b/src/interfaces/libpq++/pglobject.cc
deleted file mode 100644
index 5db38d74a5d..00000000000
--- a/src/interfaces/libpq++/pglobject.cc
+++ /dev/null
@@ -1,180 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pglobject.cc
-*
-* DESCRIPTION
-* implementation of the PgLargeObject class.
-* PgLargeObject encapsulates a frontend to backend connection
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.11 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include "pglobject.h"
-
-extern "C"
-{
-#include "libpq/libpq-fs.h"
-}
-
-#ifdef HAVE_NAMESPACE_STD
-using namespace std;
-#endif
-
-
-// ****************************************************************
-//
-// PgLargeObject Implementation
-//
-// ****************************************************************
-// default constructor
-// creates a large object in the default database
-// See PQconnectdb() for conninfo usage
-PgLargeObject::PgLargeObject(const char* conninfo)
- : PgConnection(conninfo)
-{
- Init();
- if (! ConnectionBad())
- {
- Create();
- Open();
- }
-}
-
-// constructor
-// open an existing large object in the default database
-// See PQconnectdb() for conninfo usage
-PgLargeObject::PgLargeObject(Oid lobjId, const char* conninfo)
- : PgConnection(conninfo)
-{
- Init(lobjId);
- if (! ConnectionBad())
- {
- if ( !pgObject )
- Create();
- Open();
- }
-}
-
-// destructor -- closes large object
-PgLargeObject::~PgLargeObject()
-{
- Close();
-}
-
-// PgLargeObject::Init
-// Initialize the variables
-void PgLargeObject::Init(Oid lobjId)
-{
- pgFd = -1;
- pgObject = lobjId;
-}
-
-// PgLargeObject::create
-// create large object and check for errors
-void PgLargeObject::Create()
-{
- // Create the object
- pgObject = lo_creat(pgConn, INV_READ | INV_WRITE);
-
- // Check for possible errors
- if (!pgObject)
- loStatus = "PgLargeObject: can't create large object" ;
- else
- loStatus = "PgLargeObject: created large object" ;
-}
-
-// PgLargeObject::open
-// open large object and check for errors
-void PgLargeObject::Open()
-{
- // Close any prior object
- Close();
- // Open the object
- pgFd = lo_open(pgConn, pgObject, INV_READ | INV_WRITE);
-
- // Check for possible errors
- string objStr( IntToString(pgObject) );
- if (pgFd < 0)
- loStatus = "PgLargeObject: can't open large object " + objStr ;
- else
- loStatus = "PgLargeObject: created and opened large object " + objStr ;
-}
-
-// PgLargeObject::unlink
-// destroy large object and delete from it from the database
-int PgLargeObject::Unlink()
-{
- // Unlink the object
- int temp = lo_unlink(pgConn, pgObject);
-
- // Initialize the large object upon success
- if (!temp)
- {
- Close();
- Init();
- }
-
- // Return the status
- return temp;
-}
-
-
-void PgLargeObject::Close()
-{
- if (pgFd >= 0)
- lo_close(pgConn, pgFd);
- pgFd = -1;
-}
-
-
-int PgLargeObject::Read(char* buf, int len)
-{
- return lo_read(pgConn, pgFd, buf, len);
-}
-
-
-int PgLargeObject::Write(const char* buf, int len)
-{
- return lo_write(pgConn, pgFd, (char*)buf, len);
-}
-
-
-int PgLargeObject::LSeek(int offset, int whence)
-{
- return lo_lseek(pgConn, pgFd, offset, whence);
-}
-
-
-int PgLargeObject::Tell() const
-{
- return lo_tell(pgConn, pgFd);
-}
-
-
-Oid PgLargeObject::Import(const char* filename)
-{
- return pgObject = lo_import(pgConn, filename);
-}
-
-
-int PgLargeObject::Export(const char* filename)
-{
- return lo_export(pgConn, pgObject, filename);
-}
-
-
-string PgLargeObject::Status() const
-{
- return loStatus;
-}
-
-Oid PgLargeObject::LOid()
-{
- return pgObject;
-}
diff --git a/src/interfaces/libpq++/pglobject.h b/src/interfaces/libpq++/pglobject.h
deleted file mode 100644
index b44187b6902..00000000000
--- a/src/interfaces/libpq++/pglobject.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pglobject.h
-*
-* DESCRIPTION
-* declaration of the PGlobj class.
-* PGlobj encapsulates a large object interface to Postgres backend
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-*
-* $Id: pglobject.h,v 1.11 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#ifndef PGLOBJECT_H
-#define PGLOBJECT_H
-
-#ifndef PGCONNECTION_H
-#include "pgconnection.h"
-#endif
-
-#ifdef HAVE_NAMESPACE_STD
-#define PGSTD std::
-#else
-#define PGSTD
-#endif
-
-
-// ****************************************************************
-//
-// PgLargeObject - a class for accessing Large Object in a database
-//
-// ****************************************************************
-class DLLIMPORT PgLargeObject : public PgConnection
-{
-private:
- int pgFd;
- Oid pgObject;
- PGSTD string loStatus;
- void Init(Oid lobjId = 0);
-
-public:
- explicit PgLargeObject(const char* conninfo = 0); // use reasonable defaults and create large object
- explicit PgLargeObject(Oid lobjId, const char* conninfo = 0); // use reasonable defaults and open large object
- ~PgLargeObject(); // close connection and clean up
-
- void Create();
- void Open();
- void Close();
- int Read(char* buf, int len);
- int Write(const char* buf, int len);
- int LSeek(int offset, int whence);
- int Tell() const;
- int Unlink();
- Oid LOid();
- Oid Import(const char* filename);
- int Export(const char* filename);
- PGSTD string Status() const;
-
-private:
- // We don't support copying of PgLargeObject objects,
- // so make copy constructor and assignment op private.
- PgLargeObject(const PgLargeObject&);
- PgLargeObject& operator= (const PgLargeObject&);
-};
-
-
-#undef PGSTD
-
-#endif // PGLOBJECT_H
diff --git a/src/interfaces/libpq++/pgtransdb.cc b/src/interfaces/libpq++/pgtransdb.cc
deleted file mode 100644
index d3efee5c7c6..00000000000
--- a/src/interfaces/libpq++/pgtransdb.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* FILE
-* pgtransdb.cpp
-*
-* DESCRIPTION
-* implementation of the PgTransaction class.
-* PgConnection encapsulates a transaction querying to backend
-*
-* Copyright (c) 1994, Regents of the University of California
-*
-* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgtransdb.cc,v 1.5 2002/07/02 16:32:19 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#include "pgtransdb.h"
-
-// ****************************************************************
-//
-// PgTransaction Implementation
-//
-// ****************************************************************
-// Make a connection to the specified database with default environment
-// See PQconnectdb() for conninfo usage.
-PgTransaction::PgTransaction(const char* conninfo)
- : PgDatabase(conninfo),
- pgCommitted(true)
-{
- BeginTransaction();
-}
-
-// Destructor: End the transaction block
-PgTransaction::~PgTransaction()
-{
- if (!pgCommitted)
- Exec("ABORT");
-}
-
-// Begin the transaction block
-ExecStatusType PgTransaction::BeginTransaction()
-{
- pgCommitted = false;
- return Exec("BEGIN");
-} // End BeginTransaction()
-
-// Begin the transaction block
-ExecStatusType PgTransaction::EndTransaction()
-{
- pgCommitted = true;
- return Exec("END");
-} // End EndTransaction()
-
diff --git a/src/interfaces/libpq++/pgtransdb.h b/src/interfaces/libpq++/pgtransdb.h
deleted file mode 100644
index af98d565266..00000000000
--- a/src/interfaces/libpq++/pgtransdb.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-------------------------------------------------------------------------
-*
-* pgtransdb.h
-*
-*
-* DESCRIPTION
-* Postgres Transaction Database Class:
-* Query Postgres backend using a transaction block
-*
-* NOTES
-* Currently under construction.
-*
-* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
-* Portions Copyright (c) 1994, Regents of the University of California
-*
-*
-* $Id: pgtransdb.h,v 1.11 2002/07/18 04:49:30 momjian Exp $
-*
-*-------------------------------------------------------------------------
-*/
-
-#ifndef PGTRANSDB_H
-#define PGTRANSDB_H
-
-#ifndef PGDATABASE_H
-#include "pgdatabase.h"
-#endif
-
-// ****************************************************************
-//
-// PgTransaction - a class for running transactions against databases
-//
-// ****************************************************************
-// This is the database access class that keeps an open
-// transaction block during its lifetime. The block is ABORTed when
-// the object is destroyed, unless you call EndTransaction() method
-// before destruction of the object.
-class DLLIMPORT PgTransaction : public PgDatabase
-{
-public:
- explicit PgTransaction(const char* conninfo); // use reasonable & environment defaults
- // connect to the database with given environment and database name
- // explicit PgTransaction(const PgConnection&);
- ~PgTransaction(); // close connection and clean up
-
- ExecStatusType BeginTransaction();
- ExecStatusType EndTransaction();
-
-protected:
- PgTransaction() : PgDatabase(), pgCommitted(true)
- {} // Do not connect
-
-
-private:
- bool pgCommitted;
-
- // We don't support copying of PgTransaction objects,
- // so make copy constructor and assignment op private.
- PgTransaction(const PgTransaction&);
- PgTransaction& operator= (const PgTransaction&);
-}
-; // End PgTransaction Class Declaration
-
-#endif // PGTRANSDB_H
diff --git a/src/interfaces/libpq++/win32.mak b/src/interfaces/libpq++/win32.mak
deleted file mode 100644
index fe95ee5912d..00000000000
--- a/src/interfaces/libpq++/win32.mak
+++ /dev/null
@@ -1,126 +0,0 @@
-# Makefile for Microsoft Visual C++ 6.0 (or compat)
-
-# Will build a Win32 static library (non-debug) libpq++.lib
-# and a Win32 dynamic library (non-debug) libpq++.dll with import library libpq++dll.lib
-
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-.SUFFIXES : .cc
-
-CPP=cl.exe
-RSC=rc.exe
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\libpq++.dll" "$(OUTDIR)\libpq++.lib"
-
-CLEAN :
- -@erase "$(INTDIR)\pgconnection.obj"
- -@erase "$(INTDIR)\pgcursordb.obj"
- -@erase "$(INTDIR)\pgdatabase.obj"
- -@erase "$(INTDIR)\pglobject.obj"
- -@erase "$(INTDIR)\pgtransdb.obj"
- -@erase "$(OUTDIR)\libpq++.lib"
- -@erase "$(OUTDIR)\libpq++.dll"
- -@erase "$(OUTDIR)\libpq++dll.exp"
- -@erase "$(OUTDIR)\libpq++dll.lib"
- -@erase "$(OUTDIR)\libpq++dll.res"
- -@erase "*.pch"
- -@erase "$(OUTDIR)\libpq++.pch"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /TP /MD /W3 /GX /O2 /I "..\..\include" /I "..\libpq" /D "NDEBUG" /D\
- "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq++.pch" /YX\
- /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP"
-
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libpq++.lib"
-LIB32_OBJS= \
- "$(OUTDIR)\pgconnection.obj" \
- "$(OUTDIR)\pgcursordb.obj" \
- "$(OUTDIR)\pgdatabase.obj" \
- "$(OUTDIR)\pglobject.obj" \
- "$(OUTDIR)\pgtransdb.obj"
-
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq++dll.res"
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib\
- odbccp32.lib libpq.lib msvcrt.lib /nologo /subsystem:windows /dll /incremental:no\
- /pdb:"$(OUTDIR)\libpq++.pdb" /machine:I386 /out:"$(OUTDIR)\libpq++.dll"\
- /implib:"$(OUTDIR)\libpq++dll.lib" /libpath:"..\libpq\release"
-LINK32_OBJS= \
- "$(OUTDIR)\pgconnection.obj" \
- "$(OUTDIR)\pgcursordb.obj" \
- "$(OUTDIR)\pgdatabase.obj" \
- "$(OUTDIR)\pglobject.obj" \
- "$(OUTDIR)\pgtransdb.obj" \
- "$(OUTDIR)\libpq++dll.res"
-
-"$(INTDIR)\libpq++dll.res" : "$(INTDIR)" libpq++dll.rc
- $(RSC) $(RSC_PROJ) libpq++dll.rc
-
-"$(OUTDIR)\libpq++.lib" : "$(OUTDIR)" $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(LIB32_OBJS)
-<<
-
-"$(OUTDIR)\libpq++.dll" : "$(OUTDIR)" $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cc{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cc{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
diff --git a/src/win32.mak b/src/win32.mak
index e5ae1c64c9f..a20e9fda1c2 100644
--- a/src/win32.mak
+++ b/src/win32.mak
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/src/win32.mak,v 1.6 2001/08/24 22:42:28 petere Exp $
+# $Header: /cvsroot/pgsql/src/win32.mak,v 1.7 2002/08/22 00:15:08 scrappy Exp $
# Makefile for Microsoft Visual C++ 5.0 (or compat)
# Top-file makefile for Win32 parts of postgresql.
@@ -20,8 +20,6 @@ ALL:
cd ..
cd interfaces\libpq
nmake /f win32.mak $(MAKEMACRO)
- cd ..\libpq++
- nmake /f win32.mak $(MAKEMACRO)
cd ..\..\bin\psql
nmake /f win32.mak $(MAKEMACRO)
cd ..\..