Was this helpful?
Command Line Operations
The following sections describe commands that you can use to turn your embedded SQL/C source program into an executable program. These commands preprocess, compile, and link your program.
esqlc Command – Invoke Embedded SQL Preprocessor for C
The following command line invokes the C preprocessor:
esqlc {flags} {filename}
where flags are those shown in the following table:
Informs the preprocessor to generate code that complies with ANSI and ISO Entry SQL92 data retrieval rules for fixed length char variables. At runtime, data selected into fixed length char host variables will be padded with blanks up to the declared length of the variable less one byte for the C null terminator.
Informs the preprocessor to generate code that complies with current Ingres data retrieval rules. At runtime, data selected into fixed length char host variables will not be blankpadded, it will be null terminated to the length of the data retrieved. The default is noblank_pad.
Causes ESQL/C applications to check fixed length host string variables for an end of string null terminator. If one is not found an error condition is raised. This feature is provided for ISO Entry SQL92 conformity.
Turns off the above checking. This option is the default.
Adds debugging information to the runtime database error messages generated by embedded SQL. The source file name, line number and the erroneous statement itself are printed along with the error message.
Writes preprocessor output to the named file. If you do not specify filename, the output is sent to standard output, one screen at a time.
Sets integer size to N bytes. N is 1, 2, or 4. The default is 4.
Writes preprocessor error messages to the preprocessor's listing file, as well as to the terminal. The listing file includes preprocessor error messages and your source text in a file named filename.lis, where filename is the name of the input file.
Like -l, but the generated C code also appears in the listing file.
Directs the preprocessor not to generate output files for include files. This flag does not affect the translated include statements in the main program. The preprocessor generates a default extension for the translated include file statements unless you use the o.ext flag.
-o. ext
Specifies the extension the preprocessor gives to both the translated include statements in the main program and the generated output files. If you do not specify this flag, the default extension is .c. If you use this flag in combination with the o flag, then the preprocessor generates the specified extension for the translated include statements but does not generate output files for the include statements.
Directs the preprocessor to include a header file containing ANSI style function prototypes for the Ingres runtime routines. The default is noprototypes (the prototypes in the header file are not ANSI style).
Reads input from standard input and generates C code to standard output. This is useful for unfamiliar testing statements. If you specify the l option with this flag, the listing file is called stdin.lis. To terminate the interactive session, type Ctrl + D (UNIX) or Ctrl + Z (VMS).
Indicates the file declares an integer variable named SQLCODE to receive status information from SQL statements. That declaration need not be in an exec sql begin/end declare section. This feature is provided for ISO Entry SQL92 conformity. However, the ISO 92 specification describes SQLCODE as a deprecated feature and recommends using the SQLSTATE variable.
Tells the preprocessor not to assume the existence of a status variable named SQLCODE. The default is nosqlcode.
Prints warning messages.
This flag is identical to ‑wsql=open. However, ‑wopen is supported only for backwards capability. For more information, see ‑wsql=open.
Generates # line directive to the C compiler (by default, they are in comments). This flag can prove helpful when debugging the error messages from the C compiler.
Causes the preprocessor to flag any usage of syntax or features that do not conform to the ISO Entry SQL92 entry level standard. (This is also known as the FIPS flagger option.)
Use open only with OpenSQL syntax.
‑wsql = open generates a warning if the preprocessor encounters an embedded SQL statement that does not conform to OpenSQL syntax. (For OpenSQL syntax, see the OpenSQL Reference Guide.) This flag is useful if you intend to port an application across different Enterprise Access products. The warnings do not affect the generated code and the output file may be compiled. This flag does not validate the statement syntax for any Enterprise Access product whose syntax is more restrictive than that of OpenSQL.
Windows: Shows the command line options for esqlc.
UNIX: Shows the command line options for esqlc.
VMS: Shows the command line options for esqlc.
The embedded SQL/C preprocessor assumes that input files are named with the extension.sc. You can override this default by specifying the file extension of the input file(s) on the command line. The output of the preprocessor is a file of generated C statements with the same name and the extension.c.
If you enter the command without specifying any flags or a filename, a list of flags available for the command are displayed.
esqlc Command Options
The following table presents the command options available with esqlc:
esqlc file1
Preprocesses file1.sc to file1.c
esqlc -l file2.xc
Preprocesses file2.xc to file2.c and creates listing file2.lis
esqlc -s
Accepts input from standard input
esqlc -ffile3.out file3
Preprocesses file3.sc to file3.out
Displays a list of flags available for this command
The C Compiler
The preprocessor generates C code. You can then use the following platform-specific commands to compile this code.
Windows: You can use the Windows cl command to compile this code. All compiler options can be used.
The following example preprocesses and compiles the file test1:
esqlc test1.sc
cl -c test1.c
UNIX: The following example shell script preprocesses, compiles, and links the file test1.sc:
. $II_SYSTEM/ingres/utility/iisysdep
esqlc $program_name.sc
if [ $? != 0 ]
$CC ‑I . $CCPICFLAG $CCMACH $CCFLAGS ‑c $program_name.c # $OPTIM
if [ $? != 0 ]
$CC ‑o $program_name $program_name.o $* $CCLDMACH $II_SYSTEM/ingres/lib/libingres.a $LDLIBMACH
VMS: You can use the VMS cc command to compile the code. Most of the cc command line options can be used. You should not use the g_float qualifier (to the VAX C compiler) if floating-point values in the file are interacting with Ingres floating-point objects.
As of Ingres II 2.0/0011 (axm.vms/00) Ingres uses member alignment and IEEE floating-point formats. Embedded programs must be compiled with member alignment turned on. In addition, embedded programs accessing floating-point data (including the MONEY data type) must be compiled to recognize IEEE floating-point formats.
The VMS default qualifier /g_float is not a standard and should not be used.
On Alpha systems, hardware support for D_float is only partial, the default has changed to G_float, and support for IEEE (IEEE 754-1985 standard for floating point arithmetic) has been added. Because of this, and because IEEE is available on other platforms and is recognized as an industry standard, Ingres for OpenVMS Alpha uses the IEEE format.
All programs and libraries should be compiled using the IEEE qualifier. Do not mix programs or libraries compiled with different qualifiers.
For example:
esqlc prog.sc
cc /float=ieee prog
Failure to use the /float=ieee qualifier or the use of non-IEEE float numbers will result in unpredictable results when non-IEEE floats are used as keys or in restrictions.
The following example preprocesses and compiles the file test1. Note that both the embedded SQL preprocessor and the C compiler assume the default extensions.
esqlc test1
cc/list test1
Note:  For operating system specific information on compiling and linking ESQL/C programs, see the Readme file.
Last modified date: 06/10/2024