Records the data read from the diagnostic function. More...
#include <diagnostic.h>
Public Member Functions | |
diag_t () | |
Initializes a diag_t structure. | |
std::string | msg () const |
Generate an error message from this diag_t structure. | |
Public Attributes | |
std::string | f_connection |
The name of this connection. | |
std::string | f_message |
The corresponding error/warning/info message. | |
SQLINTEGER | f_native_errno |
The direct error number of the RDBM. | |
std::string | f_odbc_state |
The ODBC error number. | |
std::string | f_server |
The name of the server. |
Records the data read from the diagnostic function.
This class is used to encompass all the useful information from the diagnostic applied on to commands.
Definition at line 35 of file diagnostic.h.
odbcpp::diag_t::diag_t | ( | ) |
Initializes a diag_t structure.
This function initializes a diag_t structure to an empty state.
These are used in diag classes.
Definition at line 121 of file diagnostic.cpp.
std::string odbcpp::diag_t::msg | ( | ) | const |
Generate an error message from this diag_t structure.
This function merges all the available information to create an error message that can be displayed to the end user.
Definition at line 138 of file diagnostic.cpp.
References f_connection, f_message, f_native_errno, f_odbc_state, and f_server.
The name of this connection.
If the error happens and is read on a connection or a statement, this field may be named after that connection.
However, the connection name is not always available.
Definition at line 43 of file diagnostic.h.
Referenced by msg(), and odbcpp::diagnostic::set().
The corresponding error/warning/info message.
Whenever a diagnostic is returned to us, a message is assiciated to it. This is that message.
The message may include specific information at the start written between square brackets ([ and ]).
Definition at line 44 of file diagnostic.h.
Referenced by odbcpp::diagnostic::diagnostic(), msg(), and odbcpp::diagnostic::set().
The direct error number of the RDBM.
The untranslated RDBM error. This can be useful for debug purposes. It should not be presented to the end users. It can however be logged.
Definition at line 46 of file diagnostic.h.
Referenced by odbcpp::diagnostic::diagnostic(), msg(), and odbcpp::diagnostic::set().
The ODBC error number.
The translated RDBM error. Whenever the RDBM generates an error, its driver converts that internal error number into an ODBC error. This makes it a lot easier to manage errors from the outside.
Note that this state is a string of exactly 5 characters. The content of the string is defined in three parts:
The state can represent a warning. The parts should not be used to infer the category of the error since they tend to overlap.
Definition at line 45 of file diagnostic.h.
Referenced by odbcpp::diagnostic::diagnostic(), msg(), and odbcpp::diagnostic::set().
The name of the server.
If the error comes from the ODBC library and you are connected to a server (i.e. a connection or statement only), then this variable will include the name of the server you are connected to.
This is the name defined between [ and ] in your odbc.ini file.
Definition at line 42 of file diagnostic.h.
Referenced by msg(), and odbcpp::diagnostic::set().