Include files for C and C++ embedded SQL applications
.h
.
The C and C++ include files are also called header files.
EXEC SQL INCLUDE
statement and
the #include macro. The precompiler will ignore the #include, and only process files included with
the EXEC SQL INCLUDE
statement. To locate files included using EXEC SQL
INCLUDE
, the Db2® C precompiler
searches the current directory first, then the directories specified by the
DB2INCLUDE
environment variable. Consider the following examples: EXEC SQL INCLUDE payroll;
If the file specified in the
INCLUDE
statement is not enclosed in quotation marks, as shown previously, the C precompiler searches forpayroll.sqc
, thenpayroll.h
, in each directory in which it looks. On UNIX and Linux® operating systems, the C++ precompiler searches forpayroll.sqC
, thenpayroll.sqx
, thenpayroll.hpp
, thenpayroll.h
in each directory it looks. On Windows-32 bit operating systems, the C++ precompiler searches forpayroll.sqx
, thenpayroll.hpp
, thenpayroll.h
in each directory it looks.EXEC SQL INCLUDE 'pay/payroll.h';
If the file name is enclosed in quotation marks, as shown previously, no extension is added to the name.
If the file name in quotation marks does not contain an absolute path, then the contents of
DB2INCLUDE
are used to search for the file, prepended to whatever path is specified in theINCLUDE
file name. For example, on UNIX and Linux operating systems, ifDB2INCLUDE
is set to '/disk2:myfiles/c
', the C or C++ precompiler searches for './pay/payroll.h
', then '/disk2/pay/payroll.h
', and finally './myfiles/c/pay/payroll.h
'. The path where the file is actually found is displayed in the precompiler messages. On Windows operating systems, substitute back slashes (\) for the forward slashes in the previous example.Note that if the precompiler option COMPATIBILITY_MODE is set to ORA, you can use double quotation marks to specify include file names, for example,
EXEC SQL INCLUDE "abc.h";
. The Db2 database manager provides this feature to facilitate the migration of embedded SQL C applications from other database systems.
DB2INCLUDE
is cached
by the command line processor.
To change the setting of DB2INCLUDE
after any CLP
commands have been issued, enter the TERMINATE
command,
then reconnect to the database and precompile.To help relate compiler errors back to the original source, the precompiler generates #line macros in the output file. This allows the compiler to report errors using the file name and line number of the source or included source file, rather than the line number in the precompiled output source file.
However, if you specify the PREPROCESSOR
option, all the #line macros generated
by the precompiler reference the preprocessed file from the external C preprocessor. Some debuggers
and other tools that relate source code to object code do not always work well with the #line macro.
If the tool you want to use behaves unexpectedly, use the NOLINEMACRO
option (used
with Db2 PREP)
when precompiling. This option prevents the #line macros from being generated.
- SQLADEF (sqladef.h)
- This file contains function prototypes used by precompiled C and C++ applications.
- SQLCA (sqlca.h)
- This file defines the SQL Communication Area (SQLCA) structure. The SQLCA contains variables that are used by the database manager to provide an application with error information about the execution of SQL statements and API calls.
- SQLCODES (sqlcodes.h)
- This file defines constants for the SQLCODE field of the SQLCA structure.
- SQLDA (sqlda.h)
- This file defines the SQL Descriptor Area (SQLDA) structure. The SQLDA is used to pass data between an application and the database manager.
- SQLEXT (sqlext.h)
- This file contains the function prototypes and constants of those ODBC Level 1 and Level 2 APIs that are not part of the X/Open Call Level Interface specification and is therefore used with the permission of Microsoft Corporation.
- SQLE819A (sqle819a.h)
- If the code page of the database is 819 (ISO Latin-1), this sequence sorts character strings that are not FOR BIT DATA according to the host CCSID 500 (EBCDIC International) binary collation. This file is used by the CREATE DATABASE API.
- SQLE819B (sqle819b.h)
- If the code page of the database is 819 (ISO Latin-1), this sequence
sorts character strings that are not
FOR BIT DATA
according to the host CCSID 037 (EBCDIC US English) binary collation. This file is used by the CREATE DATABASE API. - SQLE850A (sqle850a.h)
- If the code page of the database is 850 (ASCII Latin-1), this
sequence sorts character strings that are not
FOR BIT DATA
according to the host CCSID 500 (EBCDIC International) binary collation. This file is used by the CREATE DATABASE API. - SQLE850B (sqle850b.h)
- If the code page of the database is 850 (ASCII Latin-1), this
sequence sorts character strings that are not
FOR BIT DATA
according to the host CCSID 037 (EBCDIC US English) binary collation. This file is used by the CREATE DATABASE API. - SQLE932A (sqle932a.h)
- If the code page of the database is 932 (ASCII Japanese), this
sequence sorts character strings that are not
FOR BIT DATA
according to the host CCSID 5035 (EBCDIC Japanese) binary collation. This file is used by the CREATE DATABASE API. - SQLE932B (sqle932b.h)
- If the code page of the database is 932 (ASCII Japanese), this
sequence sorts character strings that are not
FOR BIT DATA
according to the host CCSID 5026 (EBCDIC Japanese) binary collation. This file is used by the CREATE DATABASE API. - SQLJACB (sqljacb.h)
- This file defines constants, structures, and control blocks for the Db2 Connect interface.
- SQLSTATE (sqlstate.h)
- This file defines constants for the SQLSTATE field of the SQLCA structure.
- SQLSYSTM (sqlsystm.h)
- This file contains the platform-specific definitions used by the database manager APIs and data structures.
- SQLUDF (sqludf.h)
- This file defines constants and interface structures for writing user-defined functions (UDFs).
- SQLUV (sqluv.h)
- This file defines structures, constants, and prototypes for the asynchronous Read Log API, and APIs used by the table load and unload vendors.