summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq++/pgconnection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq++/pgconnection.h')
-rw-r--r--src/interfaces/libpq++/pgconnection.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/interfaces/libpq++/pgconnection.h b/src/interfaces/libpq++/pgconnection.h
index 125c9427a5c..c265bb833bf 100644
--- a/src/interfaces/libpq++/pgconnection.h
+++ b/src/interfaces/libpq++/pgconnection.h
@@ -11,6 +11,8 @@
* Currently under construction.
*
* Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: pgconnection.h,v 1.2 1999/05/23 01:04:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +21,7 @@
#define PGCONN_H
#include <stdio.h>
-#include "pgenv.h"
+#include <string>
extern "C" {
#include "libpq-fe.h"
@@ -36,25 +38,21 @@ extern "C" {
// derived from this class to obtain the connection interface.
class PgConnection {
protected:
- PgEnv pgEnv; // Current connection environment
PGconn* pgConn; // Connection Structures
PGresult* pgResult; // Query Result
- string pgErrorMessage; // Error messages container
int pgCloseConnection; // Flag indicating whether the connection should be closed or not
public:
- PgConnection(const char* dbName); // use reasonable defaults
- PgConnection(const PgEnv& env, const char* dbName); // connect to the database with
- // given environment and database name
- virtual ~PgConnection(); // close connection and clean up
+ PgConnection(const char* conninfo); // use reasonable & environment defaults
+ ~PgConnection(); // close connection and clean up
// Connection status and error messages
ConnStatusType Status();
- int ConnectionBad() { return Status() == CONNECTION_BAD; }
- const char* ErrorMessage() const { return pgErrorMessage.c_str(); }
+ int ConnectionBad();
+ const char* ErrorMessage();
// returns the database name of the connection
- const char* DBName() const { return PQdb(pgConn); }
+ const char* DBName();
// Query Execution interface
ExecStatusType Exec(const char* query); // send a query to the backend
@@ -63,13 +61,11 @@ public:
PGnotify* Notifies();
protected:
- ConnStatusType Connect(const char* dbName);
- void SetErrorMessage(const string&, int append = 0);
+ ConnStatusType Connect(const char* conninfo);
string IntToString(int);
protected:
PgConnection();
- PgConnection(const PgConnection&);
};
#endif // PGCONN_H