mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +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:
@@ -12,6 +12,9 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* $Id: pgdatabase.h,v 1.2 1999/05/23 01:04:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -31,52 +34,32 @@
|
||||
// results are being received.
|
||||
class PgDatabase : public PgConnection {
|
||||
public:
|
||||
PgDatabase(const char* dbName) : PgConnection(dbName) {} // use reasonable defaults
|
||||
// connect to the database with given environment and database name
|
||||
PgDatabase(const PgEnv& env, const char* dbName) : PgConnection(env, dbName) {}
|
||||
PgDatabase(const PgConnection& conn) : PgConnection(conn) {pgCloseConnection = 0;}
|
||||
~PgDatabase() {} // close connection and clean up
|
||||
PgDatabase(const char* conninfo) : PgConnection(conninfo) {} // use reasonable defaults
|
||||
~PgDatabase() {} ; // close connection and clean up
|
||||
|
||||
// query result access
|
||||
int Tuples()
|
||||
{ return PQntuples(pgResult); }
|
||||
int Fields()
|
||||
{ return PQnfields(pgResult); }
|
||||
const char* FieldName(int field_num)
|
||||
{ return PQfname(pgResult, field_num); }
|
||||
int FieldNum(const char* field_name)
|
||||
{ return PQfnumber(pgResult, field_name); }
|
||||
Oid FieldType(int field_num)
|
||||
{ return PQftype(pgResult, field_num); }
|
||||
Oid FieldType(const char* field_name)
|
||||
{ return PQftype(pgResult, FieldNum(field_name)); }
|
||||
short FieldSize(int field_num)
|
||||
{ return PQfsize(pgResult, field_num); }
|
||||
short FieldSize(const char* field_name)
|
||||
{ return PQfsize(pgResult, FieldNum(field_name)); }
|
||||
const char* GetValue(int tup_num, int field_num)
|
||||
{ return PQgetvalue(pgResult, tup_num, field_num); }
|
||||
const char* GetValue(int tup_num, const char* field_name)
|
||||
{ return PQgetvalue(pgResult, tup_num, FieldNum(field_name)); }
|
||||
int GetLength(int tup_num, int field_num)
|
||||
{ return PQgetlength(pgResult, tup_num, field_num); }
|
||||
int GetLength(int tup_num, const char* field_name)
|
||||
{ return PQgetlength(pgResult, tup_num, FieldNum(field_name)); }
|
||||
void DisplayTuples(FILE *out = 0, int fillAlign = 1, const char* fieldSep = "|",
|
||||
int printHeader = 1, int quiet = 0)
|
||||
{ PQdisplayTuples(pgResult, (out ? out : stdout), fillAlign, fieldSep, printHeader, quiet); }
|
||||
void PrintTuples(FILE *out = 0, int printAttName = 1, int terseOutput = 0, int width = 0)
|
||||
{ PQprintTuples(pgResult, (out ? out : stdout), printAttName, terseOutput, width); }
|
||||
int Tuples();
|
||||
int Fields();
|
||||
const char* FieldName(int field_num);
|
||||
int FieldNum(const char* field_name);
|
||||
Oid FieldType(int field_num);
|
||||
Oid FieldType(const char* field_name);
|
||||
short FieldSize(int field_num);
|
||||
short FieldSize(const char* field_name);
|
||||
const char* GetValue(int tup_num, int field_num);
|
||||
const char* GetValue(int tup_num, const char* field_name);
|
||||
int GetLength(int tup_num, int field_num);
|
||||
int GetLength(int tup_num, const char* field_name);
|
||||
void DisplayTuples(FILE *out = 0, int fillAlign = 1,
|
||||
const char* fieldSep = "|",int printHeader = 1, int quiet = 0) ;
|
||||
void PrintTuples(FILE *out = 0, int printAttName = 1,
|
||||
int terseOutput = 0, int width = 0) ;
|
||||
|
||||
// copy command related access
|
||||
int GetLine(char* string, int length)
|
||||
{ return PQgetline(pgConn, string, length); }
|
||||
void PutLine(const char* string)
|
||||
{ PQputline(pgConn, string); }
|
||||
const char* OidStatus()
|
||||
{ return PQoidStatus(pgResult); }
|
||||
int EndCopy()
|
||||
{ return PQendcopy(pgConn); }
|
||||
int GetLine(char* string, int length);
|
||||
void PutLine(const char* string);
|
||||
const char* OidStatus();
|
||||
int EndCopy();
|
||||
|
||||
protected:
|
||||
PgDatabase() : PgConnection() {} // Do not connect
|
||||
|
Reference in New Issue
Block a user