Chapter 2. Class overview

To work with libpqxx™, you need to be aware of at least the following classes. These are all introduced in a dedicated namespace, pqxx:

I would also like to use this opportunity to plug the invaluable sqlesc function, which you should use whenever you want to include a variable as a string in your SQL (eg. insert it into a CHAR field in a table). See below.

There are other classes that may be of interest to you; these are either not essential to writing a simple program using libpqxx™, or are used in such a way that knowledge of them is not immediately necessary. You will probably want to look them up at some point when it becomes necessary to understand complex compiler warnings. Unfortunately C++ compilers are not yet very good at unravelling template-related errors and making them readable, so you may find some long and strange names when they happen.

Some of the classes you may become interested in fairly quickly are:

Finally, there are also some functions that you may want to know about, that live alone in the pqxx namespace without being part of any class:



[2] Actually libpqxx™ provides three classes doing this at various levels of reliability, called nontransaction, transaction, and robusttransaction for no, standard, and best reliability respectively.