PostgreSQL 8.2.23 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 29. libpq - C Library | Fast Forward | Next |
These functions may be used to interrogate the status of an existing database connection object.
Tip: libpq application programmers should be careful to maintain the PGconn abstraction. Use the accessor functions described below to get at the contents of PGconn. Reference to internal PGconn fields using libpq-int.h is not recommended because they are subject to change in the future.
The following functions return parameter values established at connection. These values are fixed for the life of the PGconn object.
PQdb
Returns the database name of the connection.
char *PQdb(const PGconn *conn);
PQuser
Returns the user name of the connection.
char *PQuser(const PGconn *conn);
PQpass
Returns the password of the connection.
char *PQpass(const PGconn *conn);
PQhost
Returns the server host name of the connection.
char *PQhost(const PGconn *conn);
PQport
Returns the port of the connection.
char *PQport(const PGconn *conn);
PQtty
Returns the debug TTY of the connection. (This is obsolete, since the server no longer pays attention to the TTY setting, but the function remains for backwards compatibility.)
char *PQtty(const PGconn *conn);
PQoptions
Returns the command-line options passed in the connection request.
char *PQoptions(const PGconn *conn);
The following functions return status data that can change as operations are executed on the PGconn object.
PQstatus