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:
Flag
Description
-blank_pad
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.
-noblank_pad
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.
-check_eo
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.
-nocheckeos
Turns off the above checking. This option is the default.
-d
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.
-f[filename]
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.
-iN
Sets integer size to N bytes. N is 1, 2, or 4. The default is 4.
-l
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.
-lo
Like -l, but the generated C code also appears in the listing file.
-o
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.
-prototypes
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).
-s
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 (Linux).
-sqlcode
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.
-nosqlcode
Tells the preprocessor not to assume the existence of a status variable named SQLCODE. The default is nosqlcode.
-w
Prints warning messages.
-wopen
This flag is identical to ‑wsql=open. However, ‑wopen is supported only for backwards capability. For more information, see ‑wsql=open.
-#|-p
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.
-wsql=entry_SQL92
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.)
-wsql=open
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.
--
Linux: 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:
Command
Comment
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
esqlc
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
Linux: The following example shell script preprocesses, compiles, and links the file test1.sc:
#!/bin/sh
 
. $II_SYSTEM/ingres/utility/iisysdep
 
program_name=test1
 
esqlc $program_name.sc
if [ $? != 0 ]
then
    exit
fi
 
$CC ‑I . $CCPICFLAG $CCMACH $CCFLAGS ‑c $program_name.c # $OPTIM
if [ $? != 0 ]
then
    exit
fi
 
$CC ‑o $program_name $program_name.o $* $CCLDMACH $II_SYSTEM/ingres/lib/libingres.a $LDLIBMACH
Note:  For operating system specific information on compiling and linking ESQL/C programs, see the Readme file.
Last modified date: 08/14/2024