From Linuxnetworks
[edit] Public member functions
| Exception ( const string &, int, int )
Initializes the exception object. |
| int getCode ()
Returns the OpenDBX error code related to the error. |
| int getType ()
Returns severity indicator. |
[edit] Public member description
[edit] Exception( const string &, int, int )
Exception(
const string & msg,
int err,
int type
) throw ()
Initializes the exception object.
The first parameter, the error message, should be the human readable description of what has gone wrong. It should also be already translated to the language of the user which depends on his environment settings when e.g GNU gettext is used. Errors thrown by the OpenDBX C++ library are already translated.
The OpenDBX error code is the machine readable code for the error which has been occured.
The last parameter must be a value indicating the severity of the thrown error. If the value is smaller than zero, the error is fatal and the connection to the database can't be recovered and has to be closed and reopened before the application can try to continue. In case it's greater than zero, the operation failed but the database connection is still usable. Zero represents a successful operation and shouldn't be used because an exception should only be thrown in error conditions.
[edit] Parameters
| msg | Human readable error message |
| err | OpenDBX error code |
| type | Severity of error (negative: fatal, zero: success, positive: warning) |
[edit] Returns
- Exception
[edit] int getCode()
int getCode() throw ()
Returns the OpenDBX error code related to the error.
The machine readable code describing the error which occured can be used by the application to act differently depending on the specific error. Currently defined codes are:
- ODBX_ERR_SUCCESS
- The operation was successfully completed.
- ODBX_ERR_BACKEND
- An error occured in the native database library or in the database server.
- ODBX_ERR_NOCAP
- The capability isn't available in the currently selected backend.
- ODBX_ERR_PARAM
- One of the given parameters is invalid and doesn't match the expectations.
- ODBX_ERR_NOMEM
- An out of memory condition occured.
- ODBX_ERR_SIZE
- The internally allocated memory is unable to store the value.
- ODBX_ERR_NOTEXIST
- The backend library wasn't found or loading the library failed.
- ODBX_ERR_NOOP
- The required function isn't available or the operation isn't possible in this backend.
- ODBX_ERR_OPTION
- The given option is unknown an therefore invalid.
- ODBX_ERR_OPTRO
- The requested option is read-only and its value can't be changed.
- ODBX_ERR_OPTWR
- Setting the given option to the new value failed.
- ODBX_ERR_RESULT
- Waiting for the result set after sending a statement to the database server failed.
- ODBX_ERR_NOTSUP
- The requested functionality isn't supported by the backend.
- ODBX_ERR_HANDLE
- The internal data structure which should store the details for accessing the database are invalid.
[edit] Returns
- Error code
[edit] int getType()
int getType() throw ()
Returns severity indicator.
The returned value classifies the error thrown. In case it is negative, the error is fatal (e.g. the connection to the database is lost) and the application can't continue without closing and reopening the connection.
If the value is positive, the database wasn't able to perform the requested action but the connection is still OK and can be used to send more requests to the database. On zero, everything was successfull and no error occured. This shouldn't happen when catching one of these exceptions.
[edit] Returns
- Severity of error (negative: fatal, zero: success, positive: warning)

