Library: ODBC
Package: ODBC
Header: Poco/Data/ODBC/Diagnostics.h
Utility class providing functionality for retrieving ODBC diagnostic records. Diagnostics object must be created with corresponding handle as constructor argument. During construction, diagnostic records fields are populated and the object is ready for querying.
Member Functions: begin, connectionName, count, diagnostics, end, fields, message, nativeError, reset, serverName, sqlState
typedef std::vector < DiagnosticFields > FieldVec;
typedef typename FieldVec::const_iterator Iterator;
explicit Diagnostics(
const H & handle
);
Creates and initializes the Diagnostics.
~Diagnostics();
Destroys the Diagnostics.
Iterator begin() const;
std::string connectionName() const;
Returns the connection name. If there is no active connection, connection name defaults to NONE. If connection name is not applicable for query context (such as when querying environment handle), connection name defaults to NOT_APPLICABLE.
int count() const;
Returns the number of contained diagnostic records.
const Diagnostics & diagnostics();
Iterator end() const;
const FieldVec & fields() const;
std::string message(
int index
) const;
Returns error message.
long nativeError(
int index
) const;
Returns native error code.
void reset();
Resets the diagnostic fields container.
std::string serverName() const;
Returns the server name. If the connection has not been established, server name defaults to NONE. If server name is not applicable for query context (such as when querying environment handle), connection name defaults to NOT_APPLICABLE.
std::string sqlState(
int index
) const;
Returns SQL state.
static const std::string DATA_TRUNCATED;
static const unsigned int SQL_MESSAGE_LENGTH = 512 + 1;
static const unsigned int SQL_NAME_LENGTH = 128;
static const unsigned int SQL_STATE_SIZE = 5 + 1;