# Poco::Data::ODBC

# class Utility

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

## Description

Various utility functions

## Member Summary

Member Functions: cDataType, dataSources, dateSync, dateTimeSync, drivers, isError, mapInsert, sqlDataType, timeSync

## Types

### DSNMap

typedef std::map < std::string, std::string > DSNMap;

### DriverMap

typedef DSNMap DriverMap;

## Member Functions

### cDataType

static int cDataType(
int sqlDataType
);

Returns C data type corresponding to supplied SQL data type.

### dataSources

static DSNMap & dataSources(
DSNMap & dsnMap
);

Returns DSN-description map of available ODBC data sources.

### dateSync

static void dateSync(
Date & dt,
const SQL_DATE_STRUCT & ts
);

Transfers data from ODBC SQL_DATE_STRUCT to Poco::DateTime.

### dateSync

template < typename T, typename F > static void dateSync(
T & d,
const F & ds
);

Transfers data from ODBC SQL_DATE_STRUCT container to Poco::DateTime container.

### dateSync

static void dateSync(
SQL_DATE_STRUCT & ts,
const Date & dt
);

Transfers data from Poco::Data::Date to ODBC SQL_DATE_STRUCT.

### dateSync

template < typename C > static void dateSync(
std::vector < SQL_DATE_STRUCT > & ds,
const C & d
);

Transfers data from Poco::Data::Date vector to ODBC SQL_DATE_STRUCT container.

### dateTimeSync

static void dateTimeSync(
Poco::DateTime & dt,
const SQL_TIMESTAMP_STRUCT & ts
);

Transfers data from ODBC SQL_TIMESTAMP_STRUCT to Poco::DateTime.

### dateTimeSync

template < typename T, typename F > static void dateTimeSync(
T & dt,
const F & ts
);

Transfers data from ODBC SQL_TIMESTAMP_STRUCT container to Poco::DateTime container.

### dateTimeSync

static void dateTimeSync(
SQL_TIMESTAMP_STRUCT & ts,
const Poco::DateTime & dt
);

Transfers data from Poco::DateTime to ODBC SQL_TIMESTAMP_STRUCT.

### dateTimeSync

template < typename C > static void dateTimeSync(
std::vector < SQL_TIMESTAMP_STRUCT > & ts,
const C & dt
);

Transfers data from Poco::DateTime to ODBC SQL_TIMESTAMP_STRUCT.

### drivers

static DriverMap & drivers(
DriverMap & driverMap
);

Returns driver-attributes map of available ODBC drivers.

### isError

static bool isError(
SQLRETURN rc
);

Returns true if return code is error

### mapInsert

template < typename MapType, typename KeyArgType, typename ValueArgType > static typename MapType::iterator mapInsert(
MapType & m,
const KeyArgType & k,
const ValueArgType & v
);

Utility map "insert or replace" function (from S. Meyers: Effective STL, Item 24)

### sqlDataType

static int sqlDataType(
int cDataType
);

Returns SQL data type corresponding to supplied C data type.

### timeSync

static void timeSync(
Time & dt,
const SQL_TIME_STRUCT & ts
);

Transfers data from ODBC SQL_TIME_STRUCT to Poco::DateTime.

### timeSync

template < typename T, typename F > static void timeSync(
T & t,
const F & ts
);

Transfers data from ODBC SQL_TIME_STRUCT container to Poco::DateTime container.

### timeSync

static void timeSync(
SQL_TIME_STRUCT & ts,
const Time & dt
);

Transfers data from Poco::Data::Time to ODBC SQL_TIME_STRUCT.

### timeSync

template < typename C > static void timeSync(
std::vector < SQL_TIME_STRUCT > & ts,
const C & t
);

Transfers data from Poco::Data::Time container to ODBC SQL_TIME_STRUCT vector.