aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq++/examples
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-05-23 01:04:07 +0000
committerBruce Momjian <bruce@momjian.us>1999-05-23 01:04:07 +0000
commitb14c99d8d6bdb3155fe54e6f24e8aac32a09ed81 (patch)
tree0b63fc00dfff28c643cfafe587777ab11e5733c5 /src/interfaces/libpq++/examples
parent795f6ca66ab734559e6eed7a9466eb19b58f3166 (diff)
downloadpostgresql-b14c99d8d6bdb3155fe54e6f24e8aac32a09ed81.tar.gz
postgresql-b14c99d8d6bdb3155fe54e6f24e8aac32a09ed81.zip
Here it is. Remove or rename the current interfaces/libpq++ and untar
this file in interfaces/ It will all need to be checked in. I used the char *rcsid[] method for cvs ids so it can be strings | grep'd to find version numbers. The new version for the library is 3.0. Run configure from src/ to create the Makefile and it should be good to go. I did minimal documentation references in the README, I'll see if I can get something to Tom Lockhart rather quickly. Vince.
Diffstat (limited to 'src/interfaces/libpq++/examples')
-rw-r--r--src/interfaces/libpq++/examples/Makefile26
-rw-r--r--src/interfaces/libpq++/examples/testlibpq0.cc6
-rw-r--r--src/interfaces/libpq++/examples/testlibpq1.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlibpq2.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlibpq3.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlibpq4.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlibpq5.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlibpq6.cc4
-rw-r--r--src/interfaces/libpq++/examples/testlo.cc4
9 files changed, 26 insertions, 34 deletions
diff --git a/src/interfaces/libpq++/examples/Makefile b/src/interfaces/libpq++/examples/Makefile
index aff2fdd9bc9..0e0c07cf5fe 100644
--- a/src/interfaces/libpq++/examples/Makefile
+++ b/src/interfaces/libpq++/examples/Makefile
@@ -2,26 +2,23 @@
# Makefile for example programs
#
-SRCDIR= ../../..
-include ../../../Makefile.global
LIBNAME= libpq++
+HEADERDIR= /usr/local/pgsql/include
+LIBPQDIR= /usr/local/pgsql/lib
+
# We have to override -Werror, which makes warnings, fatal, because we
# inevitably get the warning, "abstract declarator used as declaration"
# because of our inclusion of c.h and we don't know how to stop that.
-CXXFLAGS= $(CFLAGS) -Wno-error
+CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
+
+INCLUDE_OPT= -I$(HEADERDIR)
-INCLUDE_OPT= \
- -I.. \
- -I../../../backend \
- -I../../../include \
- -I$(LIBPQDIR) \
- -I$(HEADERDIR)
CXXFLAGS+= $(INCLUDE_OPT)
-LDFLAGS+= -L.. -lpq++ -L$(LIBPQDIR) -lpq
+LDFLAGS+= -L$(LIBPQDIR) -lpq++
#
# And where libpq goes, so goes the authentication stuff...
@@ -34,17 +31,12 @@ endif
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
-all: submake $(PROGS)
+all: $(PROGS)
-$(PROGS): % : %.cc ../$(LIBNAME).a
+$(PROGS): % : %.cc
$(CXX) $(CXXFLAGS) -o $@ $@.cc $(LDFLAGS)
.PHONY: submake
-submake:
- $(MAKE) -C.. $(LIBNAME).a
-
-../$(LIBNAME).a:
- $(MAKE) -C.. $(LIBNAME).a
clean:
rm -f $(PROGS)
diff --git a/src/interfaces/libpq++/examples/testlibpq0.cc b/src/interfaces/libpq++/examples/testlibpq0.cc
index 43f8e93d15e..d432aab52fa 100644
--- a/src/interfaces/libpq++/examples/testlibpq0.cc
+++ b/src/interfaces/libpq++/examples/testlibpq0.cc
@@ -9,18 +9,18 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlibpq0.cc,v 1.3 1997/02/13 10:00:42 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlibpq0.cc,v 1.4 1999/05/23 01:04:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
-#include <libpq++.h>
+#include <libpq++.H>
int main()
{
// Open the connection to the database and make sure it's OK
- PgDatabase data("template1");
+ PgDatabase data("dbname=template1");
if ( data.ConnectionBad() ) {
cout << "Connection was unsuccessful..." << endl
<< "Error message returned: " << data.ErrorMessage() << endl;
diff --git a/src/interfaces/libpq++/examples/testlibpq1.cc b/src/interfaces/libpq++/examples/testlibpq1.cc
index ef63cf70778..53012f0ceed 100644
--- a/src/interfaces/libpq++/examples/testlibpq1.cc
+++ b/src/interfaces/libpq++/examples/testlibpq1.cc
@@ -8,7 +8,7 @@
#include <iostream.h>
#include <iomanip.h>
-#include <libpq++.h>
+#include <libpq++.H>
int main()
{
@@ -16,7 +16,7 @@ int main()
// 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 = "template1";
+ const char* dbName = "dbname=template1";
PgDatabase data(dbName);
// check to see that the backend connection was successfully made
diff --git a/src/interfaces/libpq++/examples/testlibpq2.cc b/src/interfaces/libpq++/examples/testlibpq2.cc
index c6f6215bbcc..4e0657f387b 100644
--- a/src/interfaces/libpq++/examples/testlibpq2.cc
+++ b/src/interfaces/libpq++/examples/testlibpq2.cc
@@ -8,7 +8,7 @@
#include <iostream.h>
#include <iomanip.h>
-#include <libpq++.h>
+#include <libpq++.H>
int main()
{
@@ -16,7 +16,7 @@ int main()
// 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 = "template1";
+ const char* dbName = "dbname=template1";
PgTransaction data(dbName);
// check to see that the backend connection was successfully made
diff --git a/src/interfaces/libpq++/examples/testlibpq3.cc b/src/interfaces/libpq++/examples/testlibpq3.cc
index 3c4e6ec429f..924c0c565c3 100644
--- a/src/interfaces/libpq++/examples/testlibpq3.cc
+++ b/src/interfaces/libpq++/examples/testlibpq3.cc
@@ -9,7 +9,7 @@
#include <iostream.h>
#include <iomanip.h>
-#include <libpq++.h>
+#include <libpq++.H>
int main()
{
@@ -19,7 +19,7 @@ int main()
// 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 = "template1";
+ const char* dbName = "dbname=template1";
PgCursor cData(dbName, "myportal");
// check to see that the backend connection was successfully made
diff --git a/src/interfaces/libpq++/examples/testlibpq4.cc b/src/interfaces/libpq++/examples/testlibpq4.cc
index a1b21d33a9d..7803f338c95 100644
--- a/src/interfaces/libpq++/examples/testlibpq4.cc
+++ b/src/interfaces/libpq++/examples/testlibpq4.cc
@@ -19,7 +19,7 @@ INSERT INTO TBL1 values (10);
*
*/
#include <iostream.h>
-#include <libpq++.h>
+#include <libpq++.H>
#include <stdlib.h>
main()
@@ -27,7 +27,7 @@ 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.
- char* dbName = getenv("USER"); // change this to the name of your test database
+ char* dbName = "dbname=template1";
PgDatabase data(dbName);
// Check to see that the backend connection was successfully made
diff --git a/src/interfaces/libpq++/examples/testlibpq5.cc b/src/interfaces/libpq++/examples/testlibpq5.cc
index 878499baf44..52aa37cec40 100644
--- a/src/interfaces/libpq++/examples/testlibpq5.cc
+++ b/src/interfaces/libpq++/examples/testlibpq5.cc
@@ -27,7 +27,7 @@ tuple 1: got
*
*/
#include <iostream.h>
-#include <libpq++.h>
+#include <libpq++.H>
#include <stdlib.h>
extern "C" {
#include "postgres.h" // for Postgres types
@@ -39,7 +39,7 @@ 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.
- char* dbName = getenv("USER"); // change this to the name of your test database
+ 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
diff --git a/src/interfaces/libpq++/examples/testlibpq6.cc b/src/interfaces/libpq++/examples/testlibpq6.cc
index 57be9c3fb02..1df83c9bf63 100644
--- a/src/interfaces/libpq++/examples/testlibpq6.cc
+++ b/src/interfaces/libpq++/examples/testlibpq6.cc
@@ -5,7 +5,7 @@
*
*/
#include <iostream.h>
-#include <libpq++.h>
+#include <libpq++.H>
#include <stdlib.h>
main()
@@ -13,7 +13,7 @@ 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.
- char* dbName = getenv("USER"); // change this to the name of your test database
+ char* dbName = "dbname=template1";
PgTransaction data(dbName);
// check to see that the backend connection was successfully made
diff --git a/src/interfaces/libpq++/examples/testlo.cc b/src/interfaces/libpq++/examples/testlo.cc
index df1dc6c3609..dbd3fc1393c 100644
--- a/src/interfaces/libpq++/examples/testlo.cc
+++ b/src/interfaces/libpq++/examples/testlo.cc
@@ -7,12 +7,12 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlo.cc,v 1.3 1997/02/13 10:01:05 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlo.cc,v 1.4 1999/05/23 01:04:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
-#include <libpq++.h>
+#include <libpq++.H>
#include <stdlib.h>
int main(int argc, char **argv)