1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

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.
This commit is contained in:
Bruce Momjian
1999-05-23 01:04:07 +00:00
parent 795f6ca66a
commit b14c99d8d6
28 changed files with 556 additions and 588 deletions

View File

@@ -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