Chapter 9. A Simpler C API - libpgeasy

The libpq library is very powerful. In fact, libpq is the basis for most of the other PostgreSQL APIs?the other APIs translate a high-level request into a set of calls to the libpq library. The power behind libpq comes at the price of complexity. libpgeasy lets you avoid that complexity by acting as a lightweight wrapper around the more commonly used libpq functions. The simplicity afforded by the use of libpgeasy often comes at the expense of functionality.

The functions provided by the libpgeasy library use the same data structures used by libpq. For example, when you connect to a database using libpgeasy, you get back a PGconn * ; that's the same data type that you get when you connect to a database using libpq. This means that you can mix and match calls to libpq and libpgeasy, taking advantage of the power of libpq and the simplicity of libpgeasy.

Although the data types of libpq and libpqeasy may be similar, the design philosophies of libpq and libpgeasy are very different. libpq is designed to provide access to all the features of the PostgreSQL server. Libpgeasy, on the other hand, is designed to provide a simple interface to the most commonly used PostgreSQL features.

    Part II: Programming with PostgreSQL