Updated on 2024-06-03 GMT+08:00

ecpg and Pro*C Compatibility Comparison

ecpg, provided by GaussDB, is an embedded SQL preprocessor for C programs. It differs from the Pro*C preprocessor of the A-compatible database in the behavior and semantics of compiling and executing commands, syntax, and embedded statements.

Comparison between ecpg and Pro*C:

  • Currently, ecpg does not support EXEC SQL CONTEXT ALLOCATE, EXEC SQL CONTEXT USE, and EXEC SQL Context FREE.

    Currently, ecpg does not support context allocation, use, and release. ecpg has an independent memory management mechanism. In multi-thread mode, ecpg independently establishes connections, executes SQL statements, and releases related resources in each thread. This usage mode is the same as the processing logic for each thread to allocate and release contexts in Pro*C multi-thread mode.

  • Currently, ecpg does not support EXEC SQL COMMIT WORK RELEASE.

    In ecpg, after the COMMIT statement is executed, the RELEASE option is not available. You need to execute the EXEC SQL DISCONNECT and EXEC SQL CLOSE statements to release related resources. In Pro*C, EXEC SQL COMMIT has the RELEASE option, which is used to release all resource information such as connections and cursors held by the program.

  • Currently, ecpg does not support EXEC SQL ENABLE THREAD.

    To enable macro definition in the ecpg compilation options, you need to define ENABLE_THREAD_SAFETY in the .pgc file of the main function.

  • Currently, ecpg does not support features or syntaxes such as stored procedures, packages, anonymous blocks, and flashback.