diff options
Diffstat (limited to 'src/interfaces/libpq++/pgdatabase.h')
-rw-r--r-- | src/interfaces/libpq++/pgdatabase.h | 126 |
1 files changed, 66 insertions, 60 deletions
diff --git a/src/interfaces/libpq++/pgdatabase.h b/src/interfaces/libpq++/pgdatabase.h index 4f0ca62ae02..e1e3c34f619 100644 --- a/src/interfaces/libpq++/pgdatabase.h +++ b/src/interfaces/libpq++/pgdatabase.h @@ -1,27 +1,27 @@ /*------------------------------------------------------------------------- - * - * pgdatabase.h - * - * - * DESCRIPTION - * Postgres Database Class: - * Query Postgres backend to obtain query results - * - * NOTES - * Currently under construction. - * - * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * $Id: pgdatabase.h,v 1.13 2002/06/20 20:29:54 momjian Exp $ - * - *------------------------------------------------------------------------- - */ - +* +* pgdatabase.h +* +* +* DESCRIPTION +* Postgres Database Class: +* Query Postgres backend to obtain query results +* +* NOTES +* Currently under construction. +* +* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group +* Portions Copyright (c) 1994, Regents of the University of California +* +* +* $Id: pgdatabase.h,v 1.14 2002/07/02 16:32:19 momjian Exp $ +* +*------------------------------------------------------------------------- +*/ + #ifndef PGDATABASE_H #define PGDATABASE_H - + #ifndef PGCONNECTION_H #include "pgconnection.h" #endif @@ -31,55 +31,61 @@ // PgDatabase - a class for accessing databases // // **************************************************************** -// This is the basic database access class. Its interface should +// This is the basic database access class. Its interface should // be used only after a query has been sent to the backend and // results are being received. -class DLLIMPORT PgDatabase : public PgConnection { +class DLLIMPORT PgDatabase : public PgConnection +{ public: - // connect to the database with conninfo - explicit PgDatabase(const char* conninfo) : PgConnection(conninfo) {} + // connect to the database with conninfo + explicit PgDatabase(const char* conninfo) : PgConnection(conninfo) + {} + + ~PgDatabase() + {} // close connection and clean up - ~PgDatabase() {} // close connection and clean up - typedef int size_type; - - // query result access - size_type Tuples() const; - size_type CmdTuples() const; - int Fields(); - const char* FieldName(int field_num) const; - int FieldNum(const char* field_name) const; - Oid FieldType(int field_num) const; - Oid FieldType(const char* field_name) const; - int FieldSize(int field_num) const; - int FieldSize(const char* field_name) const; - const char* GetValue(size_type tup_num, int field_num) const; - const char* GetValue(size_type tup_num, const char* field_name) const; - bool GetIsNull(size_type tup_num, int field_num) const; - bool GetIsNull(size_type tup_num, const char* field_name) const; - int GetLength(size_type tup_num, int field_num) const; - int GetLength(size_type tup_num, const char* field_name) const; + typedef int size_type; - // OBSOLESCENT (use PQprint()): - void DisplayTuples(FILE *out=0, bool fillAlign=true, - const char* fieldSep="|", bool printHeader=true, bool quiet=false) const; - void PrintTuples(FILE *out=0, bool printAttName=true, - bool terseOutput=false, bool fillAlign=false) const; + // query result access + size_type Tuples() const; + size_type CmdTuples() const; + int Fields(); + const char* FieldName(int field_num) const; + int FieldNum(const char* field_name) const; + Oid FieldType(int field_num) const; + Oid FieldType(const char* field_name) const; + int FieldSize(int field_num) const; + int FieldSize(const char* field_name) const; + const char* GetValue(size_type tup_num, int field_num) const; + const char* GetValue(size_type tup_num, const char* field_name) const; + bool GetIsNull(size_type tup_num, int field_num) const; + bool GetIsNull(size_type tup_num, const char* field_name) const; + int GetLength(size_type tup_num, int field_num) const; + int GetLength(size_type tup_num, const char* field_name) const; + + // OBSOLESCENT (use PQprint()): + void DisplayTuples(FILE *out = 0, bool fillAlign = true, + const char* fieldSep = "|", bool printHeader = true, bool quiet = false) const; + void PrintTuples(FILE *out = 0, bool printAttName = true, + bool terseOutput = false, bool fillAlign = false) const; + + // copy command related access + int GetLine(char str[], int length); + void PutLine(const char str[]); + const char* OidStatus() const; + int EndCopy(); - // copy command related access - int GetLine(char str[], int length); - void PutLine(const char str[]); - const char* OidStatus() const; - int EndCopy(); - protected: - PgDatabase() : PgConnection() {} // Do not connect + PgDatabase() : PgConnection() + {} // Do not connect + private: -// We don't support copying of PgDatabase objects, -// so make copy constructor and assignment op private. - PgDatabase(const PgDatabase&); - PgDatabase& operator= (const PgDatabase&); + // We don't support copying of PgDatabase objects, + // so make copy constructor and assignment op private. + PgDatabase(const PgDatabase&); + PgDatabase& operator= (const PgDatabase&); }; #endif // PGDATABASE_H |