1ECPG(1)                 PostgreSQL 9.2.24 Documentation                ECPG(1)
2
3
4

NAME

6       ecpg - embedded SQL C preprocessor
7

SYNOPSIS

9       ecpg [option...] file...
10

DESCRIPTION

12       ecpg is the embedded SQL preprocessor for C programs. It converts C
13       programs with embedded SQL statements to normal C code by replacing the
14       SQL invocations with special function calls. The output files can then
15       be processed with any C compiler tool chain.
16
17       ecpg will convert each input file given on the command line to the
18       corresponding C output file. Input files preferably have the extension
19       .pgc. The extension will be replaced by .c to determine the output file
20       name. The output file name can also be overridden using the -o option.
21
22       This reference page does not describe the embedded SQL language. See
23       Chapter 33, ECPG - Embedded SQL in C, in the documentation for more
24       information on that topic.
25

OPTIONS

27       ecpg accepts the following command-line arguments:
28
29       -c
30           Automatically generate certain C code from SQL code. Currently,
31           this works for EXEC SQL TYPE.
32
33       -C mode
34           Set a compatibility mode.  mode can be INFORMIX or INFORMIX_SE.
35
36       -D symbol
37           Define a C preprocessor symbol.
38
39       -h
40           Parse a header file, this option includes otion -c.
41
42       -i
43           Parse system include files as well.
44
45       -I directory
46           Specify an additional include path, used to find files included via
47           EXEC SQL INCLUDE. Defaults are .  (current directory),
48           /usr/local/include, the PostgreSQL include directory which is
49           defined at compile time (default: /usr/local/pgsql/include), and
50           /usr/include, in that order.
51
52       -o filename
53           Specifies that ecpg should write all its output to the given
54           filename.
55
56       -r option
57           Selects run-time behavior.  Option can be one of the following:
58
59           no_indicator
60               Do not use indicators but instead use special values to
61               represent null values. Historically there have been databases
62               using this approach.
63
64           prepare
65               Prepare all statements before using them. Libecpg will keep a
66               cache of prepared statements and reuse a statement if it gets
67               executed again. If the cache runs full, libecpg will free the
68               least used statement.
69
70           questionmarks
71               Allow question mark as placeholder for compatibility reasons.
72               This used to be the default long ago.
73
74       --regression
75           Run in regression testing mode.
76
77       -t
78           Turn on autocommit of transactions. In this mode, each SQL command
79           is automatically committed unless it is inside an explicit
80           transaction block. In the default mode, commands are committed only
81           when EXEC SQL COMMIT is issued.
82
83       -v
84           Print additional information including the version and the
85           "include" path.
86
87       --version
88           Print the ecpg version and exit.
89
90       -?, --help
91           Show help about ecpg command line arguments, and exit.
92

NOTES

94       When compiling the preprocessed C code files, the compiler needs to be
95       able to find the ECPG header files in the PostgreSQL include directory.
96       Therefore, you might have to use the -I option when invoking the
97       compiler (e.g., -I/usr/local/pgsql/include).
98
99       Programs using C code with embedded SQL have to be linked against the
100       libecpg library, for example using the linker options
101       -L/usr/local/pgsql/lib -lecpg.
102
103       The value of either of these directories that is appropriate for the
104       installation can be found out using pg_config(1).
105

EXAMPLES

107       If you have an embedded SQL C source file named prog1.pgc, you can
108       create an executable program using the following sequence of commands:
109
110           ecpg prog1.pgc
111           cc -I/usr/local/pgsql/include -c prog1.c
112           cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
113
114
115
116
117PostgreSQL 9.2.24                 2017-11-06                           ECPG(1)
Impressum