Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
ecpg
Prev UpPostgres Pro Client ApplicationsHome Next

ecpg

ecpg — embedded SQL C preprocessor

Synopsis

ecpg [option...]file...

Description

ecpg is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.

ecpg will convert each input file given on the command line to the corresponding C output file. Input files preferably have the extension.pgc. The extension will be replaced by.c to determine the output file name. The output file name can also be overridden using the-o option.

This reference page does not describe the embedded SQL language. SeeChapter 33 for more information on that topic.

Options

ecpg accepts the following command-line arguments:

-c

Automatically generate certain C code from SQL code. Currently, this works forEXEC SQL TYPE.

-Cmode

Set a compatibility mode.mode can beINFORMIX orINFORMIX_SE.

-Dsymbol

Define a C preprocessor symbol.

-i

Parse system include files as well.

-Idirectory

Specify an additional include path, used to find files included viaEXEC SQL INCLUDE. Defaults are. (current directory),/usr/local/include, thePostgres Pro include directory which is defined at compile time (default:/usr/local/pgsql/include), and/usr/include, in that order.

-ofilename

Specifies thatecpg should write all its output to the givenfilename.

-roption

Selects run-time behavior.Option can be one of the following:

no_indicator

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.

-t

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 whenEXEC SQL COMMIT is issued.

-v

Print additional information including the version and the "include" path.

--version

Print theecpg version and exit.

-?
--help

Show help aboutecpg command line arguments, and exit.

Notes

When compiling the preprocessed C code files, the compiler needs to be able to find theECPG header files in thePostgres Pro 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 thelibecpg 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 usingpg_config.

Examples

If you have an embedded SQL C source file namedprog1.pgc, you can create an executable program using the following sequence of commands:

ecpg prog1.pgccc -I/usr/local/pgsql/include -c prog1.ccc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg

Prev Up Next
dropuser Home pg_basebackup
pdfepub
Go to Postgres Pro Standard 9.5
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp