Library: Data/ODBC
Package: ODBC
Header: Poco/Data/ODBC/Preparation.h
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). In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement instantiates its own Preparation object. This is done once per statement execution (from StatementImpl::bindImpl()).
Preparation 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. - Preparation 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
Direct Base Classes: Poco::Data::AbstractPreparation
All Base Classes: Poco::Data::AbstractPreparation, Poco::RefCountedObject
Member Functions: actualDataSize, columns, getDataExtraction, getMaxFieldSize, maxDataSize, operator [], prepare, setDataExtraction, setMaxFieldSize
Inherited Functions: duplicate, prepare, referenceCount, release
Preparation(
const StatementHandle & rStmt,
const std::string & statement,
std::size_t maxFieldSize,
DataExtraction dataExtraction = DE_BOUND
);
Creates the Preparation.
~Preparation();
Destroys the Preparation.
std::size_t actualDataSize(
std::size_t pos
) const;
Returns the returned length. This is usually equal to the column size, except for variable length fields (BLOB and variable length strings).
std::size_t columns() const;
Returns the number of columns.
DataExtraction getDataExtraction() const;
Returns data extraction mode.
std::size_t getMaxFieldSize() const;
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.
Poco::Any & operator[] (
std::size_t pos
);
Returns reference to column data.
void prepare(
std::size_t pos,
Poco::Int8
);
Prepares an Int8.
void prepare(
std::size_t pos,
Poco::UInt8
);
Prepares an UInt8.
void prepare(
std::size_t pos,
Poco::Int16
);
Prepares an Int16.
void prepare(
std::size_t pos,
Poco::UInt16
);
Prepares an UInt16.
void prepare(
std::size_t pos,
Poco::Int32
);
Prepares an Int32.
void prepare(
std::size_t pos,
Poco::UInt32
);
Prepares an UInt32.
void prepare(
std::size_t pos,
Poco::Int64
);
Prepares an Int64.
void prepare(
std::size_t pos,
Poco::UInt64
);
Prepares an UInt64.
void prepare(
std::size_t pos,
bool
);
Prepares a boolean.
void prepare(
std::size_t pos,
float
);
Prepares a float.
void prepare(
std::size_t pos,
double
);
Prepares a double.
void prepare(
std::size_t pos,
char
);
Prepares a single character.
void prepare(
std::size_t pos,
const std::string & param38
);
Prepares a string.
void prepare(
std::size_t pos,
const Poco::Data::BLOB & param39
);
Prepares a BLOB.
void prepare(
std::size_t pos,
const Poco::Any & param40
);
Prepares an Any.
void setDataExtraction(
DataExtraction ext
);
Set data extraction mode.
void setMaxFieldSize(
std::size_t size
);
Sets maximum supported field size.