Documentation
 
 
 

28.2. ECPG Concepts

This section describes concepts that are useful when developing embedded SQL in C programs:

28.2.1. Preprocessor

The preprocessor is called ecpg. After installation it resides in the EnterpriseDB dbserver/bin directory.

28.2.2. Library

The ECPG library is called libecpg.a or libecpg.so. Additionally, the ECPG library is used for communication to the EnterpriseDB server so the source program is linked using -lecpg -lpq.

The following are the methods present in the ECPG library. These methods are "hidden" by default:

  • ECPGdebug(int on, FILE *stream) turns on debug logging if called with the first argument non-zero. Debug logging is done on stream. Most SQL statements log the arguments and the corresponding result.

    The most important being ECPGdo that is called on almost all SQL statements, logs both its expanded string, i.e. the string with all the input variables inserted, and the result from the EnterpriseDB server. This method is quite useful when searching for errors in SQL statements.

  • ECPGstatus () returns TRUE if the user is connected to the underlying database and FALSE otherwise.

 
 ©2004-2007 EnterpriseDB All Rights Reserved