mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 02:57:45 +01:00
include order
This commit is contained in:
parent
65cfa49dd9
commit
f116174324
@ -23,8 +23,8 @@
|
|||||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||||
#include "Poco/Data/ODBC/Error.h"
|
#include "Poco/Data/ODBC/Error.h"
|
||||||
#include "Poco/Data/ODBC/Utility.h"
|
#include "Poco/Data/ODBC/Utility.h"
|
||||||
#include "Poco/Data/Constants.h"
|
|
||||||
#include "Poco/Data/AbstractExtractor.h"
|
#include "Poco/Data/AbstractExtractor.h"
|
||||||
|
#include "Poco/Data/Constants.h"
|
||||||
#include "Poco/Data/Date.h"
|
#include "Poco/Data/Date.h"
|
||||||
#include "Poco/Data/Time.h"
|
#include "Poco/Data/Time.h"
|
||||||
#include "Poco/DateTime.h"
|
#include "Poco/DateTime.h"
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
#define Data_ODBC_Preparator_INCLUDED
|
#define Data_ODBC_Preparator_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/Constants.h"
|
|
||||||
#include "Poco/Data/ODBC/ODBC.h"
|
#include "Poco/Data/ODBC/ODBC.h"
|
||||||
#include "Poco/Data/ODBC/Handle.h"
|
#include "Poco/Data/ODBC/Handle.h"
|
||||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||||
#include "Poco/Data/ODBC/Utility.h"
|
#include "Poco/Data/ODBC/Utility.h"
|
||||||
#include "Poco/Data/AbstractPreparator.h"
|
#include "Poco/Data/AbstractPreparator.h"
|
||||||
|
#include "Poco/Data/Constants.h"
|
||||||
#include "Poco/Data/LOB.h"
|
#include "Poco/Data/LOB.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
#include "Poco/DynamicAny.h"
|
#include "Poco/DynamicAny.h"
|
||||||
@ -49,13 +49,13 @@ namespace ODBC {
|
|||||||
|
|
||||||
|
|
||||||
class ODBC_API Preparator : public AbstractPreparator
|
class ODBC_API Preparator : public AbstractPreparator
|
||||||
/// Class used for database preparation where we first have to register all data types
|
/// Class used for database preparation where we first have to register all data types
|
||||||
/// with respective memory output locations before extracting data.
|
/// with respective memory output locations before extracting data.
|
||||||
/// Extraction works in two-phases: first prepare is called once, then extract n-times.
|
/// 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,
|
/// In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available,
|
||||||
/// however with numerous driver implementation dependent limitations and inferior performance).
|
/// however with numerous driver implementation dependent limitations and inferior performance).
|
||||||
/// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement
|
/// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement
|
||||||
/// instantiates its own Preparator object.
|
/// instantiates its own Preparator object.
|
||||||
/// This is done once per statement execution (from StatementImpl::bindImpl()).
|
/// This is done once per statement execution (from StatementImpl::bindImpl()).
|
||||||
///
|
///
|
||||||
/// Preparator object is used to :
|
/// Preparator object is used to :
|
||||||
@ -69,7 +69,7 @@ class ODBC_API Preparator : public AbstractPreparator
|
|||||||
/// - Value datatypes in this interface prepare() calls serve only for the purpose of type distinction.
|
/// - 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.
|
/// - 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
|
/// - prepare() methods should not be called when extraction mode is DE_MANUAL
|
||||||
///
|
///
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<char*> CharArray;
|
typedef std::vector<char*> CharArray;
|
||||||
@ -96,8 +96,8 @@ public:
|
|||||||
DT_DATETIME
|
DT_DATETIME
|
||||||
};
|
};
|
||||||
|
|
||||||
Preparator(const StatementHandle& rStmt,
|
Preparator(const StatementHandle& rStmt,
|
||||||
const std::string& statement,
|
const std::string& statement,
|
||||||
std::size_t maxFieldSize,
|
std::size_t maxFieldSize,
|
||||||
DataExtraction dataExtraction = DE_BOUND);
|
DataExtraction dataExtraction = DE_BOUND);
|
||||||
/// Creates the Preparator.
|
/// Creates the Preparator.
|
||||||
@ -395,12 +395,12 @@ public:
|
|||||||
|
|
||||||
std::size_t maxDataSize(std::size_t pos) const;
|
std::size_t maxDataSize(std::size_t pos) const;
|
||||||
/// Returns max supported size for column at position pos.
|
/// Returns max supported size for column at position pos.
|
||||||
/// Returned length for variable length fields is the one
|
/// Returned length for variable length fields is the one
|
||||||
/// supported by this implementation, not the underlying DB.
|
/// supported by this implementation, not the underlying DB.
|
||||||
|
|
||||||
std::size_t actualDataSize(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) const;
|
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.
|
/// Returns the returned length for the column and row specified.
|
||||||
/// This is usually equal to the column size, except for
|
/// This is usually equal to the column size, except for
|
||||||
/// variable length fields (BLOB and variable length strings).
|
/// variable length fields (BLOB and variable length strings).
|
||||||
/// For null values, the return value is -1 (SQL_NO_DATA)
|
/// For null values, the return value is -1 (SQL_NO_DATA)
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ private:
|
|||||||
if (pVal)
|
if (pVal)
|
||||||
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, pVal->size());
|
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, pVal->size());
|
||||||
else
|
else
|
||||||
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
|
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||||
|
|
||||||
case MetaColumn::FDT_UINT8:
|
case MetaColumn::FDT_UINT8:
|
||||||
if (pVal)
|
if (pVal)
|
||||||
@ -548,7 +548,7 @@ private:
|
|||||||
else
|
else
|
||||||
return prepareFixedSize<DateTime>(pos, SQL_C_TYPE_TIMESTAMP);
|
return prepareFixedSize<DateTime>(pos, SQL_C_TYPE_TIMESTAMP);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw DataFormatException("Unsupported data type.");
|
throw DataFormatException("Unsupported data type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,11 +567,11 @@ private:
|
|||||||
_values[pos] = Poco::Any(T());
|
_values[pos] = Poco::Any(T());
|
||||||
|
|
||||||
T* pVal = AnyCast<T>(&_values[pos]);
|
T* pVal = AnyCast<T>(&_values[pos]);
|
||||||
if (Utility::isError(SQLBindCol(_rStmt,
|
if (Utility::isError(SQLBindCol(_rStmt,
|
||||||
(SQLUSMALLINT) pos + 1,
|
(SQLUSMALLINT) pos + 1,
|
||||||
valueType,
|
valueType,
|
||||||
(SQLPOINTER) pVal,
|
(SQLPOINTER) pVal,
|
||||||
(SQLINTEGER) dataSize,
|
(SQLINTEGER) dataSize,
|
||||||
&_lengths[pos])))
|
&_lengths[pos])))
|
||||||
{
|
{
|
||||||
throw StatementException(_rStmt, "SQLBindCol()");
|
throw StatementException(_rStmt, "SQLBindCol()");
|
||||||
@ -596,11 +596,11 @@ private:
|
|||||||
std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]);
|
std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]);
|
||||||
cache.resize(length);
|
cache.resize(length);
|
||||||
|
|
||||||
if (Utility::isError(SQLBindCol(_rStmt,
|
if (Utility::isError(SQLBindCol(_rStmt,
|
||||||
(SQLUSMALLINT) pos + 1,
|
(SQLUSMALLINT) pos + 1,
|
||||||
valueType,
|
valueType,
|
||||||
(SQLPOINTER) &cache[0],
|
(SQLPOINTER) &cache[0],
|
||||||
(SQLINTEGER) dataSize,
|
(SQLINTEGER) dataSize,
|
||||||
&_lenLengths[pos][0])))
|
&_lenLengths[pos][0])))
|
||||||
{
|
{
|
||||||
throw StatementException(_rStmt, "SQLBindCol()");
|
throw StatementException(_rStmt, "SQLBindCol()");
|
||||||
@ -614,18 +614,18 @@ private:
|
|||||||
poco_assert (DE_BOUND == _dataExtraction);
|
poco_assert (DE_BOUND == _dataExtraction);
|
||||||
poco_assert (pos < _values.size());
|
poco_assert (pos < _values.size());
|
||||||
|
|
||||||
T* pCache = new T[size];
|
T* pCache = new T[size];
|
||||||
std::memset(pCache, 0, size);
|
std::memset(pCache, 0, size);
|
||||||
|
|
||||||
_values[pos] = Any(pCache);
|
_values[pos] = Any(pCache);
|
||||||
_lengths[pos] = (SQLLEN) size;
|
_lengths[pos] = (SQLLEN) size;
|
||||||
_varLengthArrays.insert(IndexMap::value_type(pos, dt));
|
_varLengthArrays.insert(IndexMap::value_type(pos, dt));
|
||||||
|
|
||||||
if (Utility::isError(SQLBindCol(_rStmt,
|
if (Utility::isError(SQLBindCol(_rStmt,
|
||||||
(SQLUSMALLINT) pos + 1,
|
(SQLUSMALLINT) pos + 1,
|
||||||
valueType,
|
valueType,
|
||||||
(SQLPOINTER) pCache,
|
(SQLPOINTER) pCache,
|
||||||
(SQLINTEGER) size*sizeof(T),
|
(SQLINTEGER) size*sizeof(T),
|
||||||
&_lengths[pos])))
|
&_lengths[pos])))
|
||||||
{
|
{
|
||||||
throw StatementException(_rStmt, "SQLBindCol()");
|
throw StatementException(_rStmt, "SQLBindCol()");
|
||||||
@ -648,11 +648,11 @@ private:
|
|||||||
_lenLengths[pos].resize(length);
|
_lenLengths[pos].resize(length);
|
||||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT));
|
_varLengthArrays.insert(IndexMap::value_type(pos, DT));
|
||||||
|
|
||||||
if (Utility::isError(SQLBindCol(_rStmt,
|
if (Utility::isError(SQLBindCol(_rStmt,
|
||||||
(SQLUSMALLINT) pos + 1,
|
(SQLUSMALLINT) pos + 1,
|
||||||
valueType,
|
valueType,
|
||||||
(SQLPOINTER) pArray,
|
(SQLPOINTER) pArray,
|
||||||
(SQLINTEGER) size,
|
(SQLINTEGER) size,
|
||||||
&_lenLengths[pos][0])))
|
&_lenLengths[pos][0])))
|
||||||
{
|
{
|
||||||
throw StatementException(_rStmt, "SQLBindCol()");
|
throw StatementException(_rStmt, "SQLBindCol()");
|
||||||
|
Loading…
Reference in New Issue
Block a user