Chapter 8. The PostgreSQL C API—libpq
A user interacts with a PostgreSQL database by using an application, but how does an application interact with PostgreSQL? PostgreSQL provides a number of application programming interfaces (or APIs for short). Three of these APIs are designed to be used by applications written in C—libpq, libpgeasy, and ODBC. Each API has advantages and disadvantages. libpgeasy, for example, is very easy to use, but doesn't offer much flexibility. If your application uses the ODBC API, you gain portability at the cost of complexity.
Table 8.1 compares the three C-language APIs offered by PostgreSQL.
Table 8.1. Comparison of C Language APIs for PostgreSQL
API | Complexity | Flexibility | RDBMS Portability |
---|---|---|---|
libpq | Medium | Medium to high | PostgreSQL ... |
Get PostgreSQL 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.