libpq++

The libpq++ library enables C++ applications to interface with the PostgreSQL back end. Fundamentally, it operates in the same way as the libpq library except that much of it is implemented as classes.

libpq++ provides two main classes: PgConnection and PgDatabase.

PgConnection

This class provides the functions needed to connect to a PostgreSQL database.

PgConnection::PgConnection(const char *conninfo)

The connection info can be specified either by the connect-string argument (as in the preceding) or by expressly setting the following environmental variables:

PGDATABASE Sets the database name.
PGDATESTYLE Sets the default date style.
PGGEQO Sets the default Genetic Optimizer.
PGHOST Sets the database host.
PGOPTIONS Sets various ...

Get PostgreSQL Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.