The ESQL/C preprocessor

To preprocess, compile, and link a program that contains HCL OneDB™ ESQL/C statements, you must pass it through the HCL OneDB ESQL/C preprocessor. You use the esql command to run the preprocessor on your HCL OneDB ESQL/C source file and create an executable file. The esql command follows these steps to carry out the conversion:
  • In stage one, the HCL OneDB ESQL/C preprocessor performs the following steps:
    • Incorporates header files into the source file when it processes all include directives ($include and EXEC SQL include statements)
    • Creates or removes compile-time definitions when it processes all define ($define and EXEC SQL define) and undef ($undef and EXEC SQL undef) directives
  • In stage two, the HCL OneDB ESQL/C preprocessor processes any conditional compilation directives (ifdef, ifndef, else, elif, endif) and translates embedded SQL statements to HCL OneDB ESQL/C function calls and special data structures.

    Stages 1 and 2 mirror the preprocessor and compiler stages of the C compiler. Successful completion of the preprocessing step yields a C source file (.c extension). For information about command-line options that affect the preprocessing step, see Options that affect preprocessing.

The esql command processor is installed as part of the HCL OneDB ESQL/C product. Before you use esql, ensure that:
  • The file name of the HCL OneDB ESQL/C source file has the .ec or the .ecp.
  • The INFORMIXDIR and PATH environment variables are set correctly.

    If the INFORMIXDIR environment variable is not set in the command window or in the Windows™ Registry, it is set internally to the location of the HCL® OneDB Client SDK dynamically linked libraries.

    If the INFORMIXDIR environment variable is not set in UNIX™, an error is returned when compiling any HCL OneDB Client Software Development Kit (Client SDK) application.

    For information about how to set the INFORMIXDIR and PATH variables, see the HCL OneDB Client Products Installation Guide for your operating system.

For a detailed explanation of the syntax of the esql command, see The esql command.
Important: Always link your HCL OneDB ESQL/C program with the esql program. The lists of libraries that HCL OneDB uses can change between releases. Linking with esql assures that your HCL OneDB ESQL/C program links correctly with HCL OneDB libraries.

The C code that the HCL OneDB ESQL/C preprocessor generates might change from one release of the product to the next. Therefore, do not design HCL OneDB ESQL/C programs that depend on how HCL OneDB implements the functionality and features of the product in the C code that the HCL OneDB ESQL/C preprocessor generates. Instead, develop your programs with the functionality and features of the product that this publication describes.