Made to Order Software Corporation Logo

odbcpp: odbcpp::diag_t Class Reference

Records the data read from the diagnostic function. More...

#include <diagnostic.h>

Collaboration diagram for odbcpp::diag_t:

List of all members.

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.


Detailed Description

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.

Todo:
We would need to add a function to extract the first three entries of the f_message as defined in the ODBC documentation.

Definition at line 35 of file diagnostic.h.


Constructor & Destructor Documentation

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.

See also:
diag

Definition at line 121 of file diagnostic.cpp.


Member Function Documentation

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.

Returns:
a string with the message

Definition at line 138 of file diagnostic.cpp.

References f_connection, f_message, f_native_errno, f_odbc_state, and f_server.


Member Data Documentation

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:

  • char[0] and char[1] -- the main error code (00, HY, etc.)
  • char[2] -- the sub-error code (0, S, L, etc.)
  • char[3] and char[4] -- the error number (01, 02, 03, etc.)

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().


The documentation for this class was generated from the following files:
Generated on Mon Sep 19 12:52:27 2011 for odbcpp by  doxygen 1.6.3