OTL 4.0, OTL exception class
OTL exception class
This class is used by the OTL functions to raise exceptions. In case
if an OTL function receives a non-zero error code from the underlying database
API, the OTL function raises an exception of the otl_exception type. A
raised otl_exception may be a database error or an OTL
defined exception.
class otl_exception {
public:
- First 2047 characters of the text of the SQL statement in which the
otl_exception was raised.
char stm_text[2048];
- In case if the OTL defined exception "Incompatible
data types in stream operation" is raised, the var_info
field is filled out with variable specific information: bind variable name
/ select output column number, its datatype and the datatype of the parameter
of the operator >> or operator <<.
char var_info[256];
unsigned char msg[1000];
- The code field contains a database error code or a code of an
OTL defined exception
int code;
- The sqlstate field is used in OTL 4.0/ODBC and in OTL 4.0/DB2-CLI
only. It is always empty in OTL 4.0/OCIx. In OTL 4.0/ODBC or OTL/DB2-CLI,
the field contains the sqlstate information, the way it is defined in ODBC.
For more detail, see the ODBC Programmer's Guide, the DB2 CLI Programmer's
Guide.
unsigned char sqlstate[1000];
Extended fields, containing all ODBC /
DB2-CLI diagnostic records, retrieved by the ODBC/DB2-CLI SQLGetDiagRec()
function. otl_exception usually retrieves only the first diagnostic record
and populates the msg, code, and sqlstate fields with
it. In some cases, though, multiple diagnostic records can be retrieved.
In these cases, the extended fields get populated with the diagnostic records.
arr_len conatins the size of the xxx_arr[] fields. The xxx_arr[]
fields get allocated and deallocated dynamically, if the arr_len>0.
msg_arr[] contains the diagnostic messages, sqlstate_arr[] --
the SQLSTATE information, and code_arr[] -- the error codes.
msg, code, and sqlstate get always populated with
the first diagnostic record.
int arr_len;
char* msg_arr[];
char* sqlstate_arr[];
int code_arr[];
enum{disabled=0,enabled=1};
}; // end of otl_exception
Prev Next
Contents Go Home
Copyright © 1996, 2001, Sergei Kuchin, email: [email protected],
[email protected] .
Permission to use, copy, modify and redistribute this document for
any purpose is hereby granted without fee, provided that the above copyright
notice appear in all copies.