The include directive
The include directive allows you to specify a file to include within your Informix® ESQL/C program.
The Informix® ESQL/C preprocessor places the contents of the specified file into the Informix® ESQL/C source file. Stage 1 of the Informix® ESQL/C preprocessor reads the contents of filename into the current file at the position of the include directive.
- EXEC SQL include filename;
- $include filename;
Replace filename with the name of the file you want to include in your program. You can specify filename with or without quotation marks. If you use a full path name, however, you must enclose the path name in quotation marks.
EXEC SQL include decimal.h;
EXEC SQL include "C:\apps\finances\credits.h";
If you omit the quotation marks around the file name, Informix® ESQL/C changes the file name to lowercase characters. If you omit the path name, the Informix® ESQL/C preprocessor checks the preprocessor search path for the file. For more information about this search path, see Name the location of include files.
- The Informix®
ESQL/C header
file You do not have to use the .h file extension for the Informix® ESQL/C header file; the compiler assumes that your program refers to a file with a .h extension. The following examples show valid statements to include Informix® ESQL/C header files:
EXEC SQL include varchar.h; $include sqlda; EXEC SQL include sqlstype;
- Other user-defined files
You must specify the exact name of the file that you want to include. The compiler does not assume the .h extension when you include a header file that is not the Informix® ESQL/C header file.
The following examples show valid statements to include the files constant_defs and typedefs.h in a UNIX™ environment:EXEC SQL include constant_defs; EXEC SQL include "constant_defs"; $include typedefs.h; EXEC SQL include "typedefs.h";
You must use the Informix® ESQL/C include directive if the file you specify contains embedded SQL statements, or other Informix® ESQL/C statements.