The odbcpp exception object. More...
#include <exception.h>
Public Member Functions | |
diagnostic | get () const |
Get a copy of the diagnostic saved in this exception. | |
odbcpp_error (const diagnostic &diag) | |
Constructor an exception. | |
Static Public Attributes | |
static const SQLINTEGER | ODBCPP_INCORRECT_USE = 3 |
The library was not used as expected (order of calls, generally). | |
static const SQLINTEGER | ODBCPP_INTERNAL = 1 |
An internal error occured; this should never happen, if it does, please report! | |
static const SQLINTEGER | ODBCPP_NO_DATA = 2 |
Expected data was not available. | |
static const SQLINTEGER | ODBCPP_NONE = 0 |
No error (should not be used with odbcpp_error). | |
static const SQLINTEGER | ODBCPP_NOT_FOUND = 6 |
The specified item (a column?) was not found. | |
static const SQLINTEGER | ODBCPP_NOT_IMPLEMENTED = 4 |
This feature is not yet implemented (sorry!). | |
static const SQLINTEGER | ODBCPP_TYPE_MISMATCH = 5 |
The type of a variable (column) does not correspond to the type defined. | |
Private Attributes | |
diagnostic | f_diag |
The diagnostic that caused this exception. |
The odbcpp exception object.
This class is used to generate exception in the odbcpp library.
The content of the error is a diagnostic and a complete message. The message can be retrieved with the standard what() function call of the runtime_error that this class derives from.
try { environment env; connection conn(env); ... } catch(odbcpp_error& err) { std::cerr << "The error was: " << e.what() << std::endl; }
Definition at line 35 of file exception.h.
odbcpp::odbcpp_error::odbcpp_error | ( | const diagnostic & | diag | ) | [inline] |
Constructor an exception.
Initializes the odbcpp_error with the specified diagnostic.
[in] | diag | The diagnostic to save in this odbcpp error |
Definition at line 53 of file exception.h.
odbcpp::odbcpp_error::get | ( | ) | const [inline] |
Get a copy of the diagnostic saved in this exception.
This function retrieves a copy of the exception diagnostics.
The diagnostics are generated by calling the necessary ODBC functions (i.e. SQLGetDiagField() with 5 different fields.)
Definition at line 59 of file exception.h.
References f_diag.
odbcpp::odbcpp_error::f_diag [private] |
The diagnostic that caused this exception.
Whenever a diagnostic represents an error or a warning, it generates an exception.
The exception keeps a copy of the diagnostic so you have a changes to display the error to your user or accept a certain number of errors as "normal behavior" in some circumstances.
You can retrieve a copy of the diagnostic using the odbcpp_error::get() const function.
Definition at line 62 of file exception.h.
Referenced by get().
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_INCORRECT_USE = 3 [static] |
The library was not used as expected (order of calls, generally).
Definition at line 45 of file exception.h.
Referenced by odbcpp::record_base::bind(), and odbcpp::dynamic_record::get().
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_INTERNAL = 1 [static] |
An internal error occured; this should never happen, if it does, please report!
Definition at line 41 of file exception.h.
Referenced by odbcpp::diagnostic::diagnostic(), odbcpp::int_to_ptr(), and odbcpp::connection::set_attr().
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_NO_DATA = 2 [static] |
Expected data was not available.
Definition at line 43 of file exception.h.
Referenced by odbcpp::statement::has_data(), and odbcpp::dynamic_record::verify_column().
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_NONE = 0 [static] |
No error (should not be used with odbcpp_error).
Definition at line 39 of file exception.h.
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_NOT_FOUND = 6 [static] |
The specified item (a column?) was not found.
Definition at line 51 of file exception.h.
Referenced by odbcpp::dynamic_record::find_column().
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_NOT_IMPLEMENTED = 4 [static] |
This feature is not yet implemented (sorry!).
Definition at line 47 of file exception.h.
const SQLINTEGER odbcpp::odbcpp_error::ODBCPP_TYPE_MISMATCH = 5 [static] |
The type of a variable (column) does not correspond to the type defined.
Definition at line 49 of file exception.h.
Referenced by odbcpp::dynamic_record::verify_column().