Poco::Data::ODBC

template < typename H, SQLSMALLINT handleType >

class Diagnostics

Library: Data/ODBC
Package: ODBC
Header: Poco/Data/ODBC/Diagnostics.h

Description

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 Summary

Member Functions: begin, connectionName, count, diagnostics, end, fields, handle, message, nativeError, reset, serverName, sqlState

Nested Classes

struct DiagnosticFields

SQLGetDiagRec fields more...

Types

FieldVec

typedef std::vector < DiagnosticFields > FieldVec;

Iterator

typedef typename FieldVec::const_iterator Iterator;

Constructors

Diagnostics inline

explicit Diagnostics(
    const H & handle
);

Creates and initializes the Diagnostics.

Destructor

~Diagnostics inline

~Diagnostics();

Destroys the Diagnostics.

Member Functions

begin inline

Iterator begin() const;

connectionName inline

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.

count inline

int count() const;

Returns the number of contained diagnostic records.

diagnostics inline

const Diagnostics & diagnostics();

end inline

Iterator end() const;

fields inline

const FieldVec & fields() const;

message inline

std::string message(
    int index
) const;

Returns error message.

nativeError inline

long nativeError(
    int index
) const;

Returns native error code.

reset inline

void reset();

Resets the diagnostic fields container.

serverName inline

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.

sqlState inline

std::string sqlState(
    int index
) const;

Returns SQL state.

handle protected inline

const H & handle() const;

Variables

DATA_TRUNCATED static

inline static const std::string DATA_TRUNCATED;

SQL_MESSAGE_LENGTH static

static constexpr unsigned int SQL_MESSAGE_LENGTH = 512 + 1;

SQL_NAME_LENGTH static

static constexpr unsigned int SQL_NAME_LENGTH = 128;

SQL_STATE_SIZE static

static constexpr unsigned int SQL_STATE_SIZE = 5 + 1;