ecpg

ecpg is a set of applications and libraries designed to help facilitate an easy way to include SQL commands within C source code. Embedded SQL in C, or ecpg, is a multiplatform tool that many RDBMSs support.

The concept behind Embedded SQL is that a developer can simply type SQL queries directly into his or her C source code, and the ecpg preprocessor translates those simple SQL statements into more complex functions, thereby obviating that work needing to be done by the developer.

The output of the ecpg program is standard C code; this can then be linked against the libpq and ecpg libraries and compiled directly to binary code.

The general flow of creating a program with ecpg is illustrated in Figure 13.1.

Figure 13.1. The flow of program ...

Get PostgreSQL Essential Reference 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.