The database environment class provides C++ objects for manipulating the above environment variables:
PGenv creates an environment for the running program.
PGenv() PGenv(char* auth, char* host, char* port, char* option, char* tty)The first form of this object's constructor sets up the defaults for the program from the environment variables listed above. The second allows the programmer to hardcode the values into the program. The values of the second form relate directly to the environment variables above.
The database class is a provides C++ objects that have a connection to a backend server. To create such an object one first need the apropriate environment for the backend to access. The following constructors deal with making a connection to a backend server from a C++ program.
PGdatabase makes a new connection to a backend database server.
PGdatabase(PGenv *env, char *dbName)After a PGdatabase has been created it should be checked to make sure the connection to the database succeded before sending queries to the object. This can easily be done by retrieving the current status of the PGdatabase object with the status method.
status returns the status of the PGdatabase object.
ConnStatus PGdatabase::status()The following values are allowed:
CONNECTION_OK |
CONNECTION_BAD |