This page in other versions: Unsupported versions: 7.1 / 7.2

3.3. 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.
Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group