ESQL/C preprocessor directives

You can use the following capabilities of the HCL OneDB™ ESQL/C preprocessor when you write HCL OneDB ESQL/C code:
  • The include directive expands HCL OneDB ESQL/C include files within your program.
  • The define and undef directives create compile-time definitions.
  • The ifdef, ifndef, else, elif, and endif directives specify conditional compilation.
As with embedded SQL statements, you can use either of two formats for HCL OneDB ESQL/C preprocessor directives:
  • The EXEC SQL keywords:
    EXEC SQL preprocessor_directive;

    The EXEC SQL keywords conform to ANSI standards.

  • The dollar sign ($) notation:
    $preprocessor_directive;

In either of these formats, replace preprocessor_directive with one of the valid preprocessor directives that the following sections describe. You must terminate these directives with a semicolon (;).

The HCL OneDB ESQL/C preprocessor works in two stages. In stage 1, it acts as a preprocessor for the HCL OneDB ESQL/C code. In stage 2, it converts all of the embedded SQL code to C code.

In stage 1, the HCL OneDB ESQL/C preprocessor incorporates other files in the source file by processing all include directives ($include and EXEC SQL include statements). Also in stage 1, HCL OneDB ESQL/C creates or removes compile-time definitions by processing all define ($define and EXEC SQL define) and undef ($undef and EXEC SQL undef) directives.

The remainder of this section describes each of the HCL OneDB ESQL/C preprocessor directives in more detail.