other versions
- wheezy 9.1.21-0+deb7u1
- wheezy-backports 9.4.12-0+deb8u1~bpo7+1
- jessie 9.4.11-0+deb8u2
- jessie-backports 9.6.3-1~bpo8+1
- testing 9.6.3-3
- unstable 9.6.3-3
- experimental 10~beta1-1
other languages
ECPG(1) | PostgreSQL 9.1.21 Documentation | ECPG(1) |
NAME¶
ecpg - embedded SQL C preprocessorSYNOPSIS¶
ecpg
[option...] file...
DESCRIPTION¶
OPTIONS¶
Automatically generate certain C code from SQL
code. Currently, this works for EXEC SQL TYPE.
-C mode
Set a compatibility mode. mode can be
INFORMIX or INFORMIX_SE.
-D symbol
Define a C preprocessor symbol.
-i
Parse system include files as well.
-I directory
Specify an additional include path, used to
find files included via EXEC SQL INCLUDE. Defaults are . (current directory),
/usr/local/include, the PostgreSQL include directory which is defined at
compile time (default: /usr/local/pgsql/include), and /usr/include, in that
order.
-o filename
Specifies that ecpg should write all its
output to the given filename.
-r option
Selects run-time behavior. Option can
be one of the following:
no_indicator
-t
Do not use indicators but instead use special
values to represent null values. Historically there have been databases using
this approach.
prepare
Prepare all statements before using them.
Libecpg will keep a cache of prepared statements and reuse a statement if it
gets executed again. If the cache runs full, libecpg will free the least used
statement.
questionmarks
Allow question mark as placeholder for
compatibility reasons. This used to be the default long ago.
Turn on autocommit of transactions. In this
mode, each SQL command is automatically committed unless it is inside an
explicit transaction block. In the default mode, commands are committed only
when EXEC SQL COMMIT is issued.
-v
Print additional information including the
version and the "include" path.
--version
Print the ecpg version and exit.
--help
Show help about ecpg command line arguments,
and exit.
NOTES¶
When compiling the preprocessed C code files, the compiler needs to be able to find the ECPG header files in the PostgreSQL include directory. Therefore, you might have to use the -I option when invoking the compiler (e.g., -I/usr/local/pgsql/include). Programs using C code with embedded SQL have to be linked against the libecpg library, for example using the linker options -L/usr/local/pgsql/lib -lecpg. The value of either of these directories that is appropriate for the installation can be found out using pg_config(1).EXAMPLES¶
If you have an embedded SQL C source file named prog1.pgc, you can create an executable program using the following sequence of commands:ecpg prog1.pgc cc -I/usr/local/pgsql/include -c prog1.c cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
2016-04-02 | PostgreSQL 9.1.21 |