Application Development Guide
The host-language-specific include files (header files) for C and
C++ have the file extension .h. The include
files that are intended to be used in your applications, are described
below.
- SQL (sql.h)
- This file includes language-specific prototypes for the binder,
precompiler, and error message retrieval APIs. It also defines system
constants.
- SQLADEF (sqladef.h)
- This file contains function prototypes used by precompiled C and
C++ applications.
- SQLAPREP (sqlaprep.h)
- This file contains definitions required to write your own
precompiler.
- 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.
- SQLCLI (sqlcli.h)
- This file contains the function prototypes and constants needed to write a
Call Level Interface (DB2 CLI) application. The functions in this file
are common to both X/Open Call Level Interface and ODBC Core Level.
- SQLCLI1 (sqlcli1.h)
- This file contains the function prototypes and constants needed to write a
Call Level Interface (DB2 CLI) that makes use of the more advanced features in
DB2 CLI. Many of the functions in this file are common to both X/Open
Call Level Interface and ODBC Level 1. In addition, this file also
includes X/Open-only functions and DB2-specific functions.
This file includes both sqlcli.h and
sqlext.h (which contains ODBC Level2 API
definitions).
- 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.
- SQLEAU (sqleau.h)
- This file contains constant and structure definitions required for the DB2
security audit APIs. If you use these APIs, you need to include this
file in your program. This file also contains constant and keyword
value definitions for fields in the audit trail record. These
definitions can be used by external or vendor audit trail extract
programs.
- SQLENV (sqlenv.h)
- This file defines language-specific calls for the database environment
APIs, and the structures, constants, and return codes for those
interfaces.
- 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.
- SQLMON (sqlmon.h)
- This file defines language-specific calls for the database system monitor
APIs, and the structures, constants, and return codes for those
interfaces.
- 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). For more information on this file, see The UDF Include File: sqludf.h.
- SQLUTIL (sqlutil.h)
- This file defines the language-specific calls for the utility APIs, and
the structures, constants, and codes required for those interfaces.
- 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.
- SQLUVEND (sqluvend.h)
- This file defines structures, constants and prototypes for the APIs to be
used by the storage management vendors.
- SQLXA (sqlxa.h)
- This file contains function prototypes and constants used by applications
that use the X/Open XA Interface.
There are two methods for including files: the 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 above, the C precompiler searches for payroll.sqc,
then payroll.h, in each directory in which it looks.
On UNIX operating systems, the C++ precompiler searches for
payroll.sqC, then payroll.sqx, then
payroll.hpp, then payroll.h in each
directory in which it looks. On OS/2 or Windows-32 bit operating
systems, the C++ precompiler searches for
payroll.sqx, then payroll.hpp, then
payroll.h in each directory in which it looks.
- EXEC SQL INCLUDE 'pay/payroll.h';
If the file name is enclosed in quotation marks, as above, 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 the INCLUDE file name. For example, on
UNIX based systems, if DB2INCLUDE is set to
'/disk2:myfiles/c', the C/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 OS/2 and Windows-based operating systems, substitute back
slashes (\) for the forward slashes in the above example.
Note: | The setting of DB2INCLUDE is cached by the DB2 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 as
usual.
|
To help relate compiler errors back to the original source the precompiler
generates ANSI #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 precompiler output.
However, if you specify the PREPROCESSOR option, all the #line
macros generated by the precompiler reference the preprocessed file from the
external C preprocessor. For more information about the PREPROCESSOR
option, see C Macro Expansion.
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 wish
to use behaves unexpectedly, use the NOLINEMACRO option (used with DB2 PREP)
when precompiling. This will prevent the #line macros from
being generated.
[ Top of Page | Previous Page | Next Page ]