3.4. Database Connection Functions
PgConnectionmakes a new connection to a backend database server.PgConnection::PgConnection(const char *conninfo)
The
conninfostring is the same as for the underlying libpqPQconnectdbfunction.Although typically called from one of the access classes, a connection to a backend server is possible by creating a
PgConnectionobject.ConnectionBadreturns whether or not the connection to the backend server succeeded or failed.bool PgConnection::ConnectionBad() const
Returns true if the connection failed.
Statusreturns 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.
PgDatabasemakes a new connection to a backend database server.PgDatabase(const char *conninfo)
After a
PgDatabasehas been created it should be checked to make sure the connection to the database succeeded before sending queries to the object. This can easily be done by retrieving the current status of thePgDatabaseobject with theStatusorConnectionBadmethods.DBNamereturns the name of the current database.const char *PgConnection::DBName()
Notifiesreturns the next notification from a list of unhandled notification messages received from the backend.PGnotify* PgConnection::Notifies()
See
PQnotifiesin libpq for details.
Report a documentation issue
Read the upstream documentation. For corrections, first check the current manual.