Poco::Data::ODBC

class Preparator

File Information

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

Description

Class used for database preparation where we first have to register all data types with respective memory output locations before extracting data. Extraction works in two-phases: first prepare is called once, then extract n-times. In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available, however with numerous driver implementation dependent limitations and inferior performance). In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement instantiates its own Preparator object. This is done once per statement execution (from StatementImpl::bindImpl()).

Preparator object is used to :

1) Prepare SQL statement.
2) Provide and contain the memory locations where retrieved values are placed during recordset iteration.
3) Keep count of returned number of columns with their respective datatypes and sizes.

Notes:

- Value datatypes in this interface prepare() calls serve only for the purpose of type distinction. - Preparator keeps its own std::vector<Any> buffer for fetched data to be later retrieved by Extractor. - prepare() methods should not be called when extraction mode is DE_MANUAL

Inheritance

Direct Base Classes: Poco::Data::AbstractPreparator

All Base Classes: Poco::Data::AbstractPreparator

Member Summary

Member Functions: actualDataSize, at, bulkSize, columns, getDataExtraction, getMaxFieldSize, maxDataSize, operator [], prepare, setDataExtraction, setMaxFieldSize

Inherited Functions: getLength, isBulk, prepare, setBulk, setLength

Types

CharArray

typedef std::vector < char * > CharArray;

Ptr

typedef SharedPtr < Preparator > Ptr;

Enumerations

DataExtraction

DE_MANUAL

DE_BOUND

DataType

DT_BOOL

DT_BOOL_ARRAY

DT_CHAR

DT_WCHAR

DT_UCHAR

DT_CHAR_ARRAY

DT_WCHAR_ARRAY

DT_UCHAR_ARRAY

DT_DATE

DT_TIME

DT_DATETIME

Constructors

Preparator

Preparator(
    const Preparator & other
);

Copy constructs the Preparator.

Preparator

Preparator(
    const StatementHandle & rStmt,
    const std::string & statement,
    std::size_t maxFieldSize,
    DataExtraction dataExtraction = DE_BOUND
);

Creates the Preparator.

Destructor

~Preparator virtual

~Preparator();

Destroys the Preparator.

Member Functions

actualDataSize

std::size_t actualDataSize(
    std::size_t col,
    std::size_t row = POCO_DATA_INVALID_ROW
) const;

Returns the returned length for the column and row specified. This is usually equal to the column size, except for variable length fields (BLOB and variable length strings). For null values, the return value is -1 (SQL_NO_DATA)

at inline

Poco::Any & at(
    std::size_t pos
);

Returns reference to column data.

bulkSize inline

std::size_t bulkSize(
    std::size_t col = 0
) const;

Returns bulk size. Column argument is optional since all columns must be the same size.

columns

std::size_t columns() const;

Returns the number of columns. Resizes the internal storage iff the size is zero.

getDataExtraction inline

DataExtraction getDataExtraction() const;

Returns data extraction mode.

getMaxFieldSize inline

std::size_t getMaxFieldSize() const;

maxDataSize

std::size_t maxDataSize(
    std::size_t pos
) const;

Returns max supported size for column at position pos. Returned length for variable length fields is the one supported by this implementation, not the underlying DB.

operator []

Poco::Any & operator[] (
    std::size_t pos
);

Returns reference to column data.

prepare virtual inline

void prepare(
    std::size_t pos,
    const Poco::Int8 & val
);

Prepares an Int8.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::Int8 > & val
);

Prepares an Int8 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::Int8 > & val
);

Prepares an Int8 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::Int8 > & val
);

Prepares an Int8 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::UInt8 & val
);

Prepares an UInt8.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::UInt8 > & val
);

Prepares an UInt8 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::UInt8 > & val
);

Prepares an UInt8 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::UInt8 > & val
);

Prepares an UInt8 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::Int16 & val
);

Prepares an Int16.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::Int16 > & val
);

Prepares an Int16 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::Int16 > & val
);

Prepares an Int16 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::Int16 > & val
);

Prepares an Int16 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::UInt16 & val
);

Prepares an UInt16.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::UInt16 > & val
);

Prepares an UInt16 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::UInt16 > & val
);

Prepares an UInt16 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::UInt16 > & val
);

Prepares an UInt16 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::Int32 & val
);

Prepares an Int32.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::Int32 > & val
);

Prepares an Int32 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::Int32 > & val
);

Prepares an Int32 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::Int32 > & val
);

Prepares an Int32 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::UInt32 & val
);

Prepares an UInt32.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::UInt32 > & val
);

Prepares an UInt32 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::UInt32 > & val
);

Prepares an UInt32 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::UInt32 > & val
);

Prepares an UInt32 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::Int64 & val
);

Prepares an Int64.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::Int64 > & val
);

Prepares an Int64 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::Int64 > & val
);

Prepares an Int64 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::Int64 > & val
);

Prepares an Int64 list.

prepare virtual

void prepare(
    std::size_t pos,
    const Poco::UInt64 & val
);

Prepares an UInt64.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < Poco::UInt64 > & val
);

Prepares an UInt64 vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < Poco::UInt64 > & val
);

Prepares an UInt64 deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < Poco::UInt64 > & val
);

Prepares an UInt64 list.

prepare virtual

void prepare(
    std::size_t pos,
    const long & val
);

Prepares a long.

prepare virtual

void prepare(
    std::size_t pos,
    const unsigned long & val
);

Prepares an unsigned long.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < long > & val
);

Prepares a long vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < long > & val
);

Prepares a long deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < long > & val
);

Prepares a long list.

prepare virtual

void prepare(
    std::size_t pos,
    const bool & val
);

Prepares a boolean.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < bool > & val
);

Prepares a boolean vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < bool > & val
);

Prepares a boolean deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < bool > & val
);

Prepares a boolean list.

prepare virtual

void prepare(
    std::size_t pos,
    const float & val
);

Prepares a float.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < float > & val
);

Prepares a float vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < float > & val
);

Prepares a float deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < float > & val
);

Prepares a float list.

prepare virtual

void prepare(
    std::size_t pos,
    const double & val
);

Prepares a double.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < double > & val
);

Prepares a double vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < double > & val
);

Prepares a double deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < double > & val
);

Prepares a double list.

prepare virtual

void prepare(
    std::size_t pos,
    const char & val
);

Prepares a single character.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < char > & val
);

Prepares a single character vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < char > & val
);

Prepares a single character deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < char > & val
);

Prepares a single character list.

prepare virtual

void prepare(
    std::size_t pos,
    const std::string & val
);

Prepares a string.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < std::string > & val
);

Prepares a string vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < std::string > & val
);

Prepares a string deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < std::string > & val
);

Prepares a string list.

prepare virtual

void prepare(
    std::size_t pos,
    const UTF16String & val
);

Prepares a string.

prepare virtual

void prepare(
    std::size_t pos,
    const std::vector < UTF16String > & val
);

Prepares a string vector.

prepare virtual

void prepare(
    std::size_t pos,
    const std::deque < UTF16String > & val
);

Prepares a string deque.

prepare virtual

void prepare(
    std::size_t pos,
    const std::list < UTF16String > & val
);

Prepares a string list.

prepare

void prepare(
    std::size_t pos,
    const Poco::Data::BLOB & val
);

Prepares a BLOB.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::Data::BLOB > & val
);

Prepares a BLOB vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::Data::BLOB > & val
);

Prepares a BLOB deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::Data::BLOB > & val
);

Prepares a BLOB list.

prepare

void prepare(
    std::size_t pos,
    const Poco::Data::CLOB & val
);

Prepares a CLOB.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::Data::CLOB > & val
);

Prepares a CLOB vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::Data::CLOB > & val
);

Prepares a CLOB deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::Data::CLOB > & val
);

Prepares a CLOB list.

prepare

void prepare(
    std::size_t pos,
    const Poco::Data::Date & val
);

Prepares a Date.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::Data::Date > & val
);

Prepares a Date vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::Data::Date > & val
);

Prepares a Date deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::Data::Date > & val
);

Prepares a Date list.

prepare

void prepare(
    std::size_t pos,
    const Poco::Data::Time & val
);

Prepares a Time.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::Data::Time > & val
);

Prepares a Time vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::Data::Time > & val
);

Prepares a Time deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::Data::Time > & val
);

Prepares a Time list.

prepare

void prepare(
    std::size_t pos,
    const Poco::DateTime & val
);

Prepares a DateTime.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::DateTime > & val
);

Prepares a DateTime vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::DateTime > & val
);

Prepares a DateTime deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::DateTime > & val
);

Prepares a DateTime list.

prepare

void prepare(
    std::size_t pos,
    const Poco::UUID & val
);

Prepares a UUID.

prepare

void prepare(
    std::size_t pos,
    const Poco::Any & val
);

Prepares an Any.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::Any > & val
);

Prepares an Any vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::Any > & val
);

Prepares an Any deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::Any > & val
);

Prepares an Any list.

prepare

void prepare(
    std::size_t pos,
    const Poco::DynamicAny & val
);

Prepares a DynamicAny.

prepare

void prepare(
    std::size_t pos,
    const std::vector < Poco::DynamicAny > & val
);

Prepares a DynamicAny vector.

prepare

void prepare(
    std::size_t pos,
    const std::deque < Poco::DynamicAny > & val
);

Prepares a DynamicAny deque.

prepare

void prepare(
    std::size_t pos,
    const std::list < Poco::DynamicAny > & val
);

Prepares a DynamicAny list.

setDataExtraction inline

void setDataExtraction(
    DataExtraction ext
);

Set data extraction mode.

setMaxFieldSize inline

void setMaxFieldSize(
    std::size_t size
);

Sets maximum supported field size.

Securely control IoT edge devices from anywhere   Connect a Device