summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq++/examples/testlibpq6.cc
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/interfaces/libpq++/examples/testlibpq6.cc
parentb663f3443ba096a06970214c3e83e79f6e570b84 (diff)
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/interfaces/libpq++/examples/testlibpq6.cc')
-rw-r--r--src/interfaces/libpq++/examples/testlibpq6.cc68
1 files changed, 0 insertions, 68 deletions
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;
-}