PostgreSQL 9.4.1 Documentation | |||
---|---|---|---|
Prev | Up | Chapter 33.ECPG - EmbeddedSQL in C | Next |
33.16. Internals
This section explains howECPG works internally. This information can occasionally be useful to help users understand how to useECPG.
The first four lines written byecpg to the output are fixed lines. Two are comments and two are include lines necessary to interface to the library. Then the preprocessor reads through the file and writes output. Normally it just echoes everything to the output.
When it sees anEXEC SQL statement, it intervenes and changes it. The command starts withEXEC SQL and ends with;. Everything in between is treated as anSQL statement and parsed for variable substitution. Variable substitution occurs when a symbol starts with a colon (:). The variable with that name is looked up among the variables that were previously declared within aEXEC SQL DECLARE section. The most important function in the library is The arguments are: This is the line number of the original line; used in error messages only.ECPGdo
, which takes care of executing most commands. It takes a variable number of arguments. This can easily add up to 50 or so arguments, and we hope this will not be a problem on any platform.