Class Poco::Data::ODBC::Diagnostics
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Data::ODBC

# template < typename H, SQLSMALLINT handleType >

# class Diagnostics

Library: 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, message, nativeError, reset, serverName, sqlState

## Nested Classes

### struct DiagnosticFields

SQLGetDiagRec fields

## Types

### FieldVec

typedef std::vector < DiagnosticFields > FieldVec;

### Iterator

typedef typename FieldVec::const_iterator Iterator;

## Constructors

### Diagnostics

explicit Diagnostics(
const H & handle
);

Creates and initializes the Diagnostics.

## Destructor

### ~Diagnostics

~Diagnostics();

Destroys the Diagnostics.

## Member Functions

### begin

Iterator begin() const;

### connectionName

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

int count() const;

Returns the number of contained diagnostic records.

### diagnostics

const Diagnostics & diagnostics();

### end

Iterator end() const;

### fields

const FieldVec & fields() const;

### message

std::string message(
int index
) const;

Returns error message.

### nativeError

long nativeError(
int index
) const;

Returns native error code.

### reset

void reset();

Resets the diagnostic fields container.

### serverName

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

std::string sqlState(
int index
) const;

Returns SQL state.

## Variables

### DATA_TRUNCATED

static const std::string DATA_TRUNCATED;

### SQL_MESSAGE_LENGTH

static const unsigned int SQL_MESSAGE_LENGTH = 512 + 1;

### SQL_NAME_LENGTH

static const unsigned int SQL_NAME_LENGTH = 128;

### SQL_STATE_SIZE

static const unsigned int SQL_STATE_SIZE = 5 + 1;