PostgreSQL Programmer's Guide
Prev | Chapter 18. libpq - C++ Binding Library | Next

# Database Connection Functions

- `PgConnection` makes a new connection to a backend database server.

      	PgConnection::PgConnection(const char *conninfo)

  Although typically called from one of the access classes, a connection to a backend server is possible by creating a PgConnection object.

- `ConnectionBad` returns whether or not the connection to the backend server succeeded or failed.

      	int PgConnection::ConnectionBad()

  Returns TRUE if the connection failed.

- `Status` returns the status of the connection to the backend server.

      	ConnStatusType PgConnection::Status()

  Returns either CONNECTION_OK or CONNECTION_BAD depending on the state of the connection.

- `PgDatabase` makes a new connection to a backend database server.

      	PgDatabase(const char *conninfo)

  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` or `ConnectionBad` methods.

- `DBName` Returns the name of the current database.

      	const char *PgConnection::DBName()

- `Notifies` Returns the next notification from a list of unhandled notification messages received from the backend.

      	PGnotify* PgConnection::Notifies()

  See PQnotifies() for details.

Prev | Home | Next
libpq++ Classes | Up | Query Execution Functions