The ITErrorManager class
Base class: ITObject
Manages error callbacks from the server or from the client library. Multiple callbacks can be set on an ITErrorManager instance. ITErrorManager defines functionality used by a number of subclasses for managing and dispatching errors for different operations, such as issuing queries and retrieving results. Using the ITErrorManager class, applications can set callback functions to be triggered by exceptional conditions generated during database access.
Events that might trigger the call to callback functions
are:
- Server exceptions-SQL errors, transaction state changes, warnings, and other exceptions.
- DataBlade® API library exceptions.
- C++ library events.
Callback functions must have the following signature:
typedef void (*ITCallBackFuncPtr)
(const ITErrorManager &errorobject,
void *userdata,
long errorlevel);
The userdata parameter is for data passed to the callback function. The error-level parameter corresponds to the DataBlade® API error level, and indicates whether the error is a message, an exception, or an unrecoverable error.
This class provides the following methods.
Method | Description |
---|---|
ITBool Error() const | Returns TRUE if either a server
or client error occurs. |
const ITString &SqlState() const | Returns the SQLSTATE code of an error. For details about SQLSTATE, see the Informix® Guide to SQL: Syntax. |
const ITString &ErrorText() const | Returns error message text. |
ITBool AddCallback(ITCallbackFuncPtr userfunc, void *userdata) | Adds a callback. For details, see Implementation notes. |
ITBool DelCallback(ITCallbackFuncPtr userfunc, void *userdata) | Deletes a user-defined callback registered through AddCallback(). |
ITBool DispatchErrorText(const ITString &message) | Dispatches an error message with the specified message text. |
ITBool Warn() const | Returns TRUE if a warning occurred. |
const ITString & WarningText() const | Returns warning message text. |