Client 1—Connecting to the Server

The libpqxx class library includes a number of public classes you use to interact with the PostgreSQL server. libpqxx also includes a number of private classes you aren't supposed to peek at. All the public components are defined in the pqxx namespace (private classes are defined in a separate namespace). That means you must prefix all libpqxx class names with pqxx:: or include a using namespace pqxx; directive near the top of your source files.

Every libpqxx client includes at least one object of class connection (or a class derived from connection). The connection class, as you might expect, represents a connection to a server. Class connection offers three constructors:

 connection(); connection( const std::string ...

Get PostgreSQL, Second Edition 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.