Syntax of the esql command

The following topics describe the syntax of the esql command.

This section organizes the command-line options by the processing phase that they affect:
  • Preprocessing options determine how esql translates the embedded SQL statements.
  • Compilation options affect the compilation phase, when the C compiler translates the C source to object code.
  • Linking options affect the linking phase, when the C compiler links the object code to produce an executable file.
(1)
Notes:
  • 1 Order of the arguments that follow esql at this level does not matter. For example, -e can come before -local.
  • 2 Allowed only if esql is running on a UNIX™ operating system.
  • 3 Allowed only if esql is running on a Windows™ operating system.
-ansi
Causes esql to warn you if the source file uses HCL OneDB™ extensions to ANSI-standard SQL syntax. This argument only affects source files to the right of it on the command line. See Check for ANSI-standard SQL syntax.
-cc ccargs
Passes ccargs to the C compiler without interpreting or changing them. The variable ccargs represents all of the arguments between the -cc and the next occurrence of any of these arguments:
  • -l (Windows only)
  • -r (Windows only)
  • -f (Windows only)
  • any file name except those file names that are arguments for an option
See Pass options to the C compiler.
-e
Preprocesses only, no compiling or linking. The ESQL/C preprocessor produces a C source file with a .c extension. See Preprocess without compiling or linking.
-EDname
Creates a definition for name. The effect is the same as if the source file contained an ESQL/C define directive for name. If =value is included, the definition is set to value. For details, see Define and undefine definitions while preprocessing..
-EUname
Undefines the definition named name. The effect is as if the source file included the undef directive for that name. For details, see Define and undefine definitions while preprocessing.
-g
Reverses the effects of the last -G option for source files to the right of this option on the command line. See Line numbers.
-G
Normally #line directives are added to the C source code so that the C compiler can direct you to the correct line in the file when it detects an error in the C file. The -G option turns off this feature for the source files that follow it on the command line. Use the -g argument to turn the feature back on. The -nln argument is a synonym for -G. See Line numbers.
-Ipathname
Adds pathname to the search path for and C include files. The search path is used when searching for the files named in include and #include directives. See Name the location of include files.
-icheck
Tells esql to add code that generates an error if a null value is returned to a host variable that does not have an indicator variable associated with it. This argument only affects source files to the right of it on the command line. See Check for missing indicator variables.
-local
Specifies that the static cursor names and static statement IDs that you declare in a source file are local to that file. If you do not use the -local option, cursor names and statement IDs, by default, are global entities. This argument only affects source files to the right of it on the command line. See Cursor names and statement IDs.
-log logfile
Sends the error and warning messages generated by the preprocessor to the specified file instead of to standard output. This option affects only preprocessor errors and warnings. See Redirect errors and warnings.
-libs
Prevents all compiling and linking and instead shows the names of all the libraries that would be linked based on the other options.
-nln
Synonym for -G.
-nowarn
Suppresses warning messages from the preprocessor. Error messages are still issued. This argument only affects the preprocessing of source files to the right of it on the command line. See Suppress warnings.
-o outfile
Specifies the name of the output file that will be created by the compiler. See Name the executable file.
otherarg
Any argument that esql does not recognize or deal with directly is passed to the C compiler. This process allows you to include libraries, resource files, C compiler options, and similar arguments on the command line. If an argument that you want to pass to the C compiler conflicts with one of the esql arguments, use the -cc option to protect it from esql. See Pass options to the C compiler.
source.ec
The source file with the default suffix .ec.
-thread
Tells the preprocessor to create thread-safe code. See Specify versions of HCL OneDB ESQL/C general libraries.
-static
Links HCL OneDB static libraries instead of the default HCL OneDB shared libraries. See Specify versions of HCL OneDB ESQL/C general libraries.
-V
Prints the version information for your preprocessor then exits. If this argument is given then all other arguments are ignored.
-version
Prints the build and version information for your preprocessor then exits. If this argument is given then all other arguments are ignored.
-xopen
Generates warning messages for SQL statements that use HCL OneDB extensions to the X/Open standard. It also indicates that dynamic SQL statements use the X/Open set of codes for data types (when using GET DESCRIPTOR and SET DESCRIPTOR statements or an sqlda structure). See The X/Open standards.
UNIX-only arguments

1+ (1)
1  source.ecp
2?  -cp
2?  -glu
2?  -np
2?  -nup
2?  -onlycp
Notes:
  • 1 Order of the arguments at this level does not matter.
-cp
Causes esql to run the C preprocessor before the preprocessor when processing source.ec files. The SQL keywords in the file are protected from interpretation by the C preprocessor and the protection is removed after the C preprocessor runs. This argument only affects source files to the right of it on the command line. See Run the C preprocessor before the ESQL/C preprocessor.
-glu
Compile such that your application can use GLU (GLS for Unicode). For details, see Enabling the GLS for Unicode (GLU) feature.
-np
Prevents the protecting of SQL statements in source files that are processed by the C preprocessor before being processed by the preprocessor. This argument only affects source files to the right of it on the command line. See Run the C preprocessor before the ESQL/C preprocessor.
-nup
No unprotect mode. The SQL keyword protection is not removed after the C preprocessor is run. The compilation stops after the C preprocessor and the results are put in a file with the extension .icp. See Run the C preprocessor before the ESQL/C preprocessor.
-onlycp
This mode is like the -cp mode in that it forces the C preprocessor to run first before the preprocessor. However, the processing stops after the C preprocessor runs, leaving the result in a .icp file. See Run the C preprocessor before the ESQL/C preprocessor.
source.ecp
The source file with the special suffix .ecp. It is treated as a normal file that was preceded with the -cp option. See Run the C preprocessor before the ESQL/C preprocessor.
(1)
Windows-only arguments

1+ 
1  -l largs
1 -lw:width
1 -ts:width
2? @respfile
2?  -dcmdl
2?  -f filename
2?  -mserr
2?  -n
2?  -p
1 -mc
2.1  -cpu:1
2.2.1 alpha
2.2.1 i386
2.2.1 mips
2.1 -pa
2.1 -pi
2.1 -pm
4? 
5.1 -runtime:1
5.1 -rt:1
5.2.1 libc
5.2.1 s
5.2.1 libcmt
5.2.1 m
5.2.1 msvcrt
5.2.1 d
1  -target:1
2.1 dll
2.1 exe
1 -wd
1 -we
1 
2.1 -subsystem:1
2.1 -ss:1
2.2.1 console
2.2.1 c
2.2.1 windows
2.2.1 w
1 -Sc
1 -Sw
Notes:
  • 1 Ensure there is no space between this option and the part that follows.
@ respfile
Specifies a file containing additional options. For details, see Create a response file
-bc
Tells the preprocessor to use the Borland C compiler instead of the Microsoft™ Visual C++ compiler. See Specify a particular C compiler (Windows).
-cpu:
This argument has no effect if you are using Borland C to compile. This argument tells esql what type of processor you would like the executable program to be optimized for. There are three possible values:
alpha
For processors that are compatible with the Alpha architecture.
i386
For processors that are compatible with the Intel386 architecture. This is the default.
mips
For processors that use the MIPS32 or MIPS64 instructions set architecture (ISA).
-dcmdl
Shows the command line used to start the C compiler. This lets you visually verify the options that are used.
-f filename
Specifies the name of a file that contains the names of additional source files.
-l largs
Passes largs to the linker without interpreting or changing them. The largs is all of the arguments between the -cc and a -r option or the end of the line. See Pass arguments to the linker.
-lw:width
When the source file is converted into a C source file this argument causes lines in the C source file to be wrapped at the column position that width indicates. This argument only affects source files to the right of it on the command line. See Line wrapping.
-mc
Tells the preprocessor to use the Microsoft Visual C++ compiler to compile and link. See Specify a particular C compiler (Windows).
-mserr
Provides Microsoft-style messages and warnings.
-n
Prevents esql from printing a version message when it runs.
-p
Synonym for -e.
-pa
Synonym for -cpu:alpha.
-pi
Synonym for -cpu:i386.
-pm
Synonym for -cpu:mips.
-rt:
Synonym for -runtime:.
-runtime:
Determines what C runtime libraries will be linked with the executable. An indicator of the library type must follow this option with no space in between. The type must be one of the following:
d
Links a multithreaded shared library. This is the default library that is used if -runtime: is not given. You can also use the library name in place of d. If you are using Microsoft Visual C++ to compile, the library name is msvcrt. If you are using Borland C, it is cw32mti.
m
Links a static multithreaded shared library. You can also use the library name in place of m. If you are using Microsoft Visual C++ to compile, the library name is libcmt. If you are using Borland C, it is cw32mt. Cannot be used with the -static option.
s
Links a static single-threaded library. You can also use the library name in place of s. If you are using Microsoft Visual C++ to compile, the library name is libc. If you are using Borland C, it is cw32. Cannot be used with the -static option.
t
This option can be used only if you are using Borland C. It links the static multithreaded library. You can also use the library name cw32i in place of t. Cannot be used with the -static option.
-Sc
Synonym for -subsystem:console.
-ss:
Synonym for -subsystem:
-Sw
Synonym for -subsystem:windows.
-subsystem:
Determines what subsystem will be linked into the executable. An indicator of the subsystem type must follow this option with no space in between. The type must be one of the following:
console
This is the default type. It creates a console application. This indicator can be abbreviated as c.
windows
Creates a Windows application. This indicator can be abbreviated as w.
The -subsystem: option can be abbreviated -ss:.
-target:
Determines what type of file will be created. An indicator of the target type must follow this option with no space in between. The indicator must be one of the following:
dll
A Dynamic Load Library (DLL) file will be created.
exe
This is the default type. A regular executable file will be created.
-ts:width
Tells the preprocessor to define tab stops every width columns when creating the C source file. By default, the preprocessor sets tab stops every eighth column. See Set tab stops.
-v
Synonym for -V.
-wd
Synonym for -target:dll.
-we
Synonym for -target:exe.