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

# Poco::Data::ODBC

# class TypeInfo

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

## Description

Datatypes mapping utility class.

This class provides mapping between C and SQL datatypes as well as datatypes supported by the underlying database. In order for database types to be available, a valid conection handle must be supplied at either object construction time, or at a later point in time, through call to fillTypeInfo member function.

Class also provides a convenient debugging function that prints tabulated data to an output stream.

## Member Summary

Member Functions: cDataType, fillTypeInfo, getInfo, print, sqlDataType, tryGetInfo

## Types

### DataTypeMap

typedef std::map < int, int > DataTypeMap;

### TypeInfoTup

typedef Poco::NamedTuple < std::string, SQLSMALLINT, SQLINTEGER, std::string, std::string, std::string, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, std::string, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLINTEGER, SQLSMALLINT > TypeInfoTup;

### TypeInfoVec

typedef std::vector < TypeInfoTup > TypeInfoVec;

### ValueType

typedef DataTypeMap::value_type ValueType;

## Constructors

### TypeInfo

explicit TypeInfo(
SQLHDBC * pHDBC = 0
);

Creates the TypeInfo.

## Destructor

### ~TypeInfo

~TypeInfo();

Destroys the TypeInfo.

## Member Functions

### cDataType

int cDataType(
int sqlDataType
) const;

Returns C data type corresponding to supplied SQL data type.

### fillTypeInfo

void fillTypeInfo(
SQLHDBC pHDBC
);

Fills the data type info structure for the database.

### getInfo

DynamicAny getInfo(
SQLSMALLINT type,
const std::string & param
) const;

Returns information about specified data type as specified by parameter 'type'. The requested information is specified by parameter 'param'. Will fail with a Poco::NotFoundException thrown if the param is not found

### print

void print(
std::ostream & ostr
);

Prints all the types (as reported by the underlying database) to the supplied output stream.

### sqlDataType

int sqlDataType(
int cDataType
) const;

Returns SQL data type corresponding to supplied C data type.

### tryGetInfo

bool tryGetInfo(
SQLSMALLINT type,
const std::string & param,
DynamicAny & result
) const;

Returns information about specified data type as specified by parameter 'type' in param result. The requested information is specified by parameter 'param'. Will return false if the param is not found. The value of result will be not changed in this case.