Diagnostics
Diagnostics deal with warning or error conditions that are generated within an application.
Db2 ODBC functions generate
two levels of diagnostics:
- Return codes
- Detailed diagnostics (SQLSTATEs, messages, SQLCA)
Each Db2 ODBC function returns
the function return code as a basic diagnostic. The SQLGetDiagRec() function
provides more detailed diagnostic information. The SQLGetSQLCA() function
provides access to the SQLCA, if the diagnostic is reported by the
data source. This arrangement lets applications handle the basic flow
control, and the SQLSTATEs allow determination of the specific causes
of failure.
The
SQLGetDiagRec() function returns the following
three pieces of information: - SQLSTATE
- Native error: if the diagnostic is detected by the data source, this is the SQLCODE; otherwise, this is set to -99999.
- Message text: this is the message text associated with the SQLSTATE.