Chapter 3. libpq++ - C++ Binding Library

Table of Contents
3.1. Introduction
3.2. Control and Initialization
3.3. libpq++ Classes
3.3.1. Connection Class: PgConnection
3.3.2. Database Class: PgDatabase
3.4. Database Connection Functions
3.5. Query Execution Functions
3.5.1. Main Routines
3.5.2. Retrieving SELECT Result Information
3.5.3. Retrieving SELECT Result Values
3.5.4. Retrieving Non-SELECT Result Information
3.6. Asynchronous Notification
3.7. Functions Associated with the COPY Command

3.1. Introduction

libpq++ is the C++ API to PostgreSQL. libpq++ is a set of classes that allow client programs to connect to the PostgreSQL backend server. These connections come in two forms: a database class and a large object class.

The database class is intended for manipulating a database. You can send all sorts of SQL queries and commands to the PostgreSQL backend server and retrieve the responses of the server.

The large object class is intended for manipulating a large object in a database. Although a large object instance can send normal queries to the PostgreSQL backend server it is only intended for simple queries that do not return any data. A large object should be seen as a file stream. In the future it should behave much like the C++ file streams cin, cout and cerr.

This chapter is based on the documentation for the libpq C library (see Chapter 1). There are several examples of libpq++ applications in src/interfaces/libpq++/examples in the source distribution.