mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-02 05:46:22 +01:00
[SF 2272430] BLOB and CLOB
Renamed: (Abstract)Preparation => (Abstract)Preparator (Abstract)Prepare => (Abstract)Preparation
This commit is contained in:
@@ -42,7 +42,7 @@ endif
|
||||
|
||||
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
||||
Extractor ODBCMetaColumn ODBCException ODBCStatementImpl \
|
||||
Parameter Preparation SessionImpl TypeInfo Unicode Utility
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
|
||||
target = PocoODBC
|
||||
target_version = $(LIBVERSION)
|
||||
|
||||
@@ -250,52 +250,52 @@
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Binder.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Binder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ConnectionHandle.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\ConnectionHandle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Connector.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Diagnostics.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Diagnostics.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\EnvironmentHandle.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\EnvironmentHandle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Error.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Error.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Extractor.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Extractor.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Handle.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Handle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBC.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBC.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBCException.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCException.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCMetaColumn.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBCStatementImpl.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCStatementImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Parameter.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Parameter.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Preparation.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Preparator.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\TypeInfo.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\TypeInfo.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Unicode.h">
|
||||
@@ -355,7 +355,7 @@
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
|
||||
RelativePath=".\include\Poco\Data\ODBC\Utility.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
@@ -389,7 +389,7 @@
|
||||
RelativePath=".\src\Parameter.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Preparation.cpp">
|
||||
RelativePath=".\src\Preparator.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
|
||||
@@ -406,7 +406,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Preparation.h"
|
||||
RelativePath=".\include\Poco\Data\ODBC\Preparator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -474,7 +474,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Preparation.cpp"
|
||||
RelativePath=".\src\Preparator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/Parameter.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
@@ -69,7 +70,6 @@ namespace Data {
|
||||
|
||||
class Date;
|
||||
class Time;
|
||||
class BLOB;
|
||||
|
||||
|
||||
namespace ODBC {
|
||||
@@ -272,6 +272,9 @@ public:
|
||||
void bind(std::size_t pos, const BLOB& val, Direction dir);
|
||||
/// Binds a BLOB. In-bound only.
|
||||
|
||||
void bind(std::size_t pos, const CLOB& val, Direction dir);
|
||||
/// Binds a CLOB. In-bound only.
|
||||
|
||||
void bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir);
|
||||
/// Binds a BLOB vector.
|
||||
|
||||
@@ -281,6 +284,15 @@ public:
|
||||
void bind(std::size_t pos, const std::list<BLOB>& val, Direction dir);
|
||||
/// Binds a BLOB list.
|
||||
|
||||
void bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir);
|
||||
/// Binds a CLOB vector.
|
||||
|
||||
void bind(std::size_t pos, const std::deque<CLOB>& val, Direction dir);
|
||||
/// Binds a CLOB deque.
|
||||
|
||||
void bind(std::size_t pos, const std::list<CLOB>& val, Direction dir);
|
||||
/// Binds a CLOB list.
|
||||
|
||||
void bind(std::size_t pos, const Date& val, Direction dir);
|
||||
/// Binds a Date.
|
||||
|
||||
@@ -393,6 +405,40 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename L>
|
||||
void bindImplLOB(std::size_t pos, const L& val, Direction dir)
|
||||
{
|
||||
if (isOutBound(dir) || !isInBound(dir))
|
||||
throw NotImplementedException("LOB parameter type can only be inbound.");
|
||||
|
||||
SQLPOINTER pVal = (SQLPOINTER) val.rawContent();
|
||||
SQLINTEGER size = (SQLINTEGER) val.size();
|
||||
|
||||
_inParams.insert(ParamMap::value_type(pVal, size));
|
||||
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
*pLenIn = size;
|
||||
|
||||
if (PB_AT_EXEC == _paramBinding)
|
||||
*pLenIn = SQL_LEN_DATA_AT_EXEC(size);
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
pVal,
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(LOB)");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void bindImplVec(std::size_t pos, const std::vector<T>& val, SQLSMALLINT cDataType, Direction dir)
|
||||
{
|
||||
@@ -553,8 +599,11 @@ private:
|
||||
}
|
||||
|
||||
template <typename C>
|
||||
void bindImplContainerBLOB(std::size_t pos, const C& val, Direction dir)
|
||||
void bindImplContainerLOB(std::size_t pos, const C& val, Direction dir)
|
||||
{
|
||||
typedef typename C::value_type LOBType;
|
||||
typedef typename LOBType::ValueType CharType;
|
||||
|
||||
if (isOutBound(dir) || !isInBound(dir))
|
||||
throw NotImplementedException("BLOB container parameter type can only be inbound.");
|
||||
|
||||
@@ -585,7 +634,7 @@ private:
|
||||
if (_charPtrs.size() <= pos)
|
||||
_charPtrs.resize(pos + 1, 0);
|
||||
|
||||
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char));
|
||||
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(CharType));
|
||||
poco_check_ptr (_charPtrs[pos]);
|
||||
|
||||
std::size_t blobSize;
|
||||
@@ -597,7 +646,7 @@ private:
|
||||
blobSize = cIt->size();
|
||||
if (blobSize > size)
|
||||
throw LengthExceededException("SQLBindParameter(std::vector<BLOB>)");
|
||||
std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize);
|
||||
std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize * sizeof(CharType));
|
||||
offset += size;
|
||||
}
|
||||
|
||||
@@ -1203,22 +1252,51 @@ inline void Binder::bind(std::size_t pos, const std::list<std::string>& val, Dir
|
||||
bindImplContainerString(pos, val, dir);
|
||||
}
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const BLOB& val, Direction dir)
|
||||
{
|
||||
bindImplLOB<BLOB>(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const CLOB& val, Direction dir)
|
||||
{
|
||||
bindImplLOB<CLOB>(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerBLOB(pos, val, dir);
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::deque<BLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerBLOB(pos, val, dir);
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::list<BLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerBLOB(pos, val, dir);
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::deque<CLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const std::list<CLOB>& val, Direction dir)
|
||||
{
|
||||
bindImplContainerLOB(pos, val, dir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/AbstractExtractor.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
@@ -71,7 +71,7 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
|
||||
{
|
||||
public:
|
||||
Extractor(const StatementHandle& rStmt,
|
||||
Preparation& rPreparation);
|
||||
Preparator& rPreparator);
|
||||
/// Creates the Extractor.
|
||||
|
||||
~Extractor();
|
||||
@@ -250,6 +250,9 @@ public:
|
||||
bool extract(std::size_t pos, Poco::Data::BLOB& val);
|
||||
/// Extracts a BLOB.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Data::CLOB& val);
|
||||
/// Extracts a CLOB.
|
||||
|
||||
bool extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val);
|
||||
/// Extracts a BLOB vector.
|
||||
|
||||
@@ -259,6 +262,15 @@ public:
|
||||
bool extract(std::size_t pos, std::list<Poco::Data::BLOB>& val);
|
||||
/// Extracts a BLOB list.
|
||||
|
||||
bool extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val);
|
||||
/// Extracts a CLOB vector.
|
||||
|
||||
bool extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val);
|
||||
/// Extracts a CLOB deque.
|
||||
|
||||
bool extract(std::size_t pos, std::list<Poco::Data::CLOB>& val);
|
||||
/// Extracts a CLOB list.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Data::Date& val);
|
||||
/// Extracts a Date.
|
||||
|
||||
@@ -319,10 +331,10 @@ public:
|
||||
bool extract(std::size_t pos, std::list<Poco::DynamicAny>& val);
|
||||
/// Extracts a DynamicAny list.
|
||||
|
||||
void setDataExtraction(Preparation::DataExtraction ext);
|
||||
void setDataExtraction(Preparator::DataExtraction ext);
|
||||
/// Set data extraction mode.
|
||||
|
||||
Preparation::DataExtraction getDataExtraction() const;
|
||||
Preparator::DataExtraction getDataExtraction() const;
|
||||
/// Returns data extraction mode.
|
||||
|
||||
bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW);
|
||||
@@ -354,21 +366,85 @@ private:
|
||||
bool extractBoundImpl(std::size_t pos, T& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
poco_assert_dbg (typeid(T) == _rPreparation[pos].type());
|
||||
val = *AnyCast<T>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (typeid(T) == _rPreparator[pos].type());
|
||||
val = *AnyCast<T>(&_rPreparator[pos]);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename C>
|
||||
bool extractBoundImpl(std::size_t pos, Poco::Data::BLOB& val);
|
||||
bool extractBoundImpl(std::size_t pos, Poco::Data::CLOB& val);
|
||||
|
||||
template <typename C>
|
||||
bool extractBoundImplContainer(std::size_t pos, C& val)
|
||||
{
|
||||
typedef typename C::value_type Type;
|
||||
poco_assert_dbg (typeid(std::vector<Type>) == _rPreparation[pos].type());
|
||||
std::vector<Type>& v = RefAnyCast<std::vector<Type> >(_rPreparation[pos]);
|
||||
poco_assert_dbg (typeid(std::vector<Type>) == _rPreparator[pos].type());
|
||||
std::vector<Type>& v = RefAnyCast<std::vector<Type> >(_rPreparator[pos]);
|
||||
val.assign(v.begin(), v.end());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extractBoundImplContainer(std::size_t pos, std::vector<std::string>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::deque<std::string>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::list<std::string>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::vector<Poco::Data::CLOB>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::deque<Poco::Data::CLOB>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::list<Poco::Data::CLOB>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::vector<Poco::Data::BLOB>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::deque<Poco::Data::BLOB>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::list<Poco::Data::BLOB>& values);
|
||||
|
||||
template <typename C>
|
||||
bool extractBoundImplContainerString(std::size_t pos, C& values)
|
||||
{
|
||||
typedef typename C::value_type StringType;
|
||||
typedef typename C::iterator ItType;
|
||||
typedef typename StringType::value_type CharType;
|
||||
|
||||
CharType** pc = AnyCast<CharType*>(&_rPreparator[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparator.bulkSize() == values.size());
|
||||
std::size_t colWidth = columnSize(pos);
|
||||
ItType it = values.begin();
|
||||
ItType end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assign(*pc + row * colWidth, _rPreparator.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename C>
|
||||
bool extractBoundImplContainerLOB(std::size_t pos, C& values)
|
||||
{
|
||||
typedef typename C::value_type LOBType;
|
||||
typedef typename LOBType::ValueType CharType;
|
||||
typedef typename C::iterator ItType;
|
||||
|
||||
CharType** pc = AnyCast<CharType*>(&_rPreparator[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparator.bulkSize() == values.size());
|
||||
std::size_t colWidth = _rPreparator.maxDataSize(pos);
|
||||
ItType it = values.begin();
|
||||
ItType end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assignRaw(*pc + row * colWidth, _rPreparator.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool extractBoundImplLOB(std::size_t pos, Poco::Data::LOB<T>& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
|
||||
std::size_t dataSize = _rPreparator.actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
T* sp = AnyCast<T*>(_rPreparator[pos]);
|
||||
val.assignRaw(sp, dataSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool extractManualImpl(std::size_t pos, T& val, SQLSMALLINT cType)
|
||||
{
|
||||
@@ -456,6 +532,9 @@ private:
|
||||
case MetaColumn::FDT_BLOB:
|
||||
{ return extAny<T, Poco::Data::BLOB>(pos, val); }
|
||||
|
||||
case MetaColumn::FDT_CLOB:
|
||||
{ return extAny<T, Poco::Data::CLOB>(pos, val); }
|
||||
|
||||
case MetaColumn::FDT_DATE:
|
||||
{ return extAny<T, Poco::Data::Date>(pos, val); }
|
||||
|
||||
@@ -480,8 +559,8 @@ private:
|
||||
SQLINTEGER columnSize(std::size_t pos) const;
|
||||
|
||||
const StatementHandle& _rStmt;
|
||||
Preparation& _rPreparation;
|
||||
Preparation::DataExtraction _dataExtraction;
|
||||
Preparator& _rPreparator;
|
||||
Preparator::DataExtraction _dataExtraction;
|
||||
std::vector<SQLLEN> _lengths;
|
||||
};
|
||||
|
||||
@@ -489,13 +568,86 @@ private:
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline void Extractor::setDataExtraction(Preparation::DataExtraction ext)
|
||||
|
||||
inline bool Extractor::extractBoundImpl(std::size_t pos, Poco::Data::BLOB& val)
|
||||
{
|
||||
_rPreparation.setDataExtraction(_dataExtraction = ext);
|
||||
return extractBoundImplLOB<BLOB::ValueType>(pos, val);
|
||||
}
|
||||
|
||||
|
||||
inline Preparation::DataExtraction Extractor::getDataExtraction() const
|
||||
inline bool Extractor::extractBoundImpl(std::size_t pos, Poco::Data::CLOB& val)
|
||||
{
|
||||
return extractBoundImplLOB<CLOB::ValueType>(pos, val);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::vector<std::string>& values)
|
||||
{
|
||||
return extractBoundImplContainerString(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::deque<std::string>& values)
|
||||
{
|
||||
return extractBoundImplContainerString(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<std::string>& values)
|
||||
{
|
||||
return extractBoundImplContainerString(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::vector<Poco::Data::CLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::deque<Poco::Data::CLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::list<Poco::Data::CLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::vector<Poco::Data::BLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::deque<Poco::Data::BLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::list<Poco::Data::BLOB>& values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline void Extractor::setDataExtraction(Preparator::DataExtraction ext)
|
||||
{
|
||||
_rPreparator.setDataExtraction(_dataExtraction = ext);
|
||||
}
|
||||
|
||||
|
||||
inline Preparator::DataExtraction Extractor::getDataExtraction() const
|
||||
{
|
||||
return _dataExtraction;
|
||||
}
|
||||
@@ -523,7 +675,7 @@ inline bool Extractor::isNullLengthIndicator(SQLLEN val) const
|
||||
inline SQLINTEGER Extractor::columnSize(std::size_t pos) const
|
||||
{
|
||||
std::size_t size = ODBCMetaColumn(_rStmt, pos).length();
|
||||
std::size_t maxSize = _rPreparation.maxDataSize(pos);
|
||||
std::size_t maxSize = _rPreparator.maxDataSize(pos);
|
||||
if (size > maxSize) size = maxSize;
|
||||
return (SQLINTEGER) size;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Extractor.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
@@ -117,8 +117,8 @@ private:
|
||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
||||
typedef Poco::SharedPtr<Binder> BinderPtr;
|
||||
typedef Poco::Data::AbstractExtractionVec Extractions;
|
||||
typedef Poco::SharedPtr<Preparation> PreparationPtr;
|
||||
typedef std::vector<PreparationPtr> PreparationVec;
|
||||
typedef Poco::SharedPtr<Preparator> PreparatorPtr;
|
||||
typedef std::vector<PreparatorPtr> PreparatorVec;
|
||||
typedef Poco::SharedPtr<Extractor> ExtractorPtr;
|
||||
typedef std::vector<ExtractorPtr> ExtractorVec;
|
||||
typedef std::vector<ODBCMetaColumn*> ColumnPtrVec;
|
||||
@@ -160,13 +160,13 @@ private:
|
||||
|
||||
void getData();
|
||||
|
||||
void addPreparation();
|
||||
void addPreparator();
|
||||
void fillColumns();
|
||||
void checkError(SQLRETURN rc, const std::string& msg="");
|
||||
|
||||
const SQLHDBC& _rConnection;
|
||||
const StatementHandle _stmt;
|
||||
PreparationVec _preparations;
|
||||
PreparatorVec _preparations;
|
||||
BinderPtr _pBinder;
|
||||
ExtractorVec _extractors;
|
||||
bool _stepCalled;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//
|
||||
// Preparation.h
|
||||
// Preparator.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/include/Poco/Data/ODBC/Preparation.h#5 $
|
||||
// $Id: //poco/Main/Data/ODBC/include/Poco/Data/ODBC/Preparator.h#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: Preparation
|
||||
// Module: Preparator
|
||||
//
|
||||
// Definition of the Preparation class.
|
||||
// Definition of the Preparator class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_ODBC_Preparation_INCLUDED
|
||||
#define Data_ODBC_Preparation_INCLUDED
|
||||
#ifndef Data_ODBC_Preparator_INCLUDED
|
||||
#define Data_ODBC_Preparator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Constants.h"
|
||||
@@ -45,8 +45,8 @@
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/DateTime.h"
|
||||
@@ -64,23 +64,22 @@ namespace Data {
|
||||
|
||||
class Date;
|
||||
class Time;
|
||||
class BLOB;
|
||||
|
||||
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Preparation : public AbstractPreparation
|
||||
class ODBC_API Preparator : public AbstractPreparator
|
||||
/// 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 Preparation object.
|
||||
/// instantiates its own Preparator object.
|
||||
/// This is done once per statement execution (from StatementImpl::bindImpl()).
|
||||
///
|
||||
/// Preparation object is used to :
|
||||
/// Preparator object is used to :
|
||||
///
|
||||
/// 1) Prepare SQL statement.
|
||||
/// 2) Provide and contain the memory locations where retrieved values are placed during recordset iteration.
|
||||
@@ -89,7 +88,7 @@ class ODBC_API Preparation : public AbstractPreparation
|
||||
/// 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.
|
||||
/// - 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
|
||||
///
|
||||
{
|
||||
@@ -107,23 +106,25 @@ public:
|
||||
DT_BOOL,
|
||||
DT_BOOL_ARRAY,
|
||||
DT_CHAR,
|
||||
DT_UCHAR,
|
||||
DT_CHAR_ARRAY,
|
||||
DT_UCHAR_ARRAY,
|
||||
DT_DATE,
|
||||
DT_TIME,
|
||||
DT_DATETIME
|
||||
};
|
||||
|
||||
Preparation(const StatementHandle& rStmt,
|
||||
Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction = DE_BOUND);
|
||||
/// Creates the Preparation.
|
||||
/// Creates the Preparator.
|
||||
|
||||
Preparation(const Preparation& other);
|
||||
/// Copy constructs the Preparation.
|
||||
Preparator(const Preparator& other);
|
||||
/// Copy constructs the Preparator.
|
||||
|
||||
~Preparation();
|
||||
/// Destroys the Preparation.
|
||||
~Preparator();
|
||||
/// Destroys the Preparator.
|
||||
|
||||
void prepare(std::size_t pos, Poco::Int8& val);
|
||||
/// Prepares an Int8.
|
||||
@@ -307,6 +308,18 @@ public:
|
||||
void prepare(std::size_t pos, const std::list<Poco::Data::BLOB>& val);
|
||||
/// Prepares a BLOB list.
|
||||
|
||||
void prepare(std::size_t pos, const Poco::Data::CLOB& val);
|
||||
/// Prepares a CLOB.
|
||||
|
||||
void prepare(std::size_t pos, const std::vector<Poco::Data::CLOB>& val);
|
||||
/// Prepares a CLOB vector.
|
||||
|
||||
void prepare(std::size_t pos, const std::deque<Poco::Data::CLOB>& val);
|
||||
/// Prepares a CLOB deque.
|
||||
|
||||
void prepare(std::size_t pos, const std::list<Poco::Data::CLOB>& val);
|
||||
/// Prepares a CLOB list.
|
||||
|
||||
void prepare(std::size_t pos, const Poco::Data::Date& val);
|
||||
/// Prepares a Date.
|
||||
|
||||
@@ -407,8 +420,8 @@ private:
|
||||
typedef std::vector<LengthVec> LengthLengthVec;
|
||||
typedef std::map<std::size_t, DataType> IndexMap;
|
||||
|
||||
Preparation();
|
||||
Preparation& operator = (const Preparation&);
|
||||
Preparator();
|
||||
Preparator& operator = (const Preparator&);
|
||||
|
||||
template <typename C>
|
||||
void prepareImpl(std::size_t pos, const C* pVal = 0)
|
||||
@@ -486,15 +499,27 @@ private:
|
||||
|
||||
case MetaColumn::FDT_STRING:
|
||||
if (pVal)
|
||||
return prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), pVal->size());
|
||||
return prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_CHAR, maxDataSize(pos), pVal->size());
|
||||
else
|
||||
return prepareVariableLen<char>(pos, SQL_C_CHAR, maxDataSize(pos), DT_CHAR);
|
||||
|
||||
case MetaColumn::FDT_BLOB:
|
||||
{
|
||||
typedef Poco::Data::BLOB::ValueType CharType;
|
||||
if (pVal)
|
||||
return prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
|
||||
return prepareCharArray<CharType, DT_UCHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
|
||||
else
|
||||
return prepareVariableLen<char>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
|
||||
return prepareVariableLen<CharType>(pos, SQL_C_BINARY, maxDataSize(pos), DT_UCHAR);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_CLOB:
|
||||
{
|
||||
typedef Poco::Data::CLOB::ValueType CharType;
|
||||
if (pVal)
|
||||
return prepareCharArray<CharType, DT_CHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
|
||||
else
|
||||
return prepareVariableLen<CharType>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_DATE:
|
||||
if (pVal)
|
||||
@@ -598,9 +623,32 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, DataType DT>
|
||||
void prepareCharArray(std::size_t pos, SQLSMALLINT valueType, std::size_t size, std::size_t length)
|
||||
/// Utility function for preparation of bulk variable length character and LOB columns.
|
||||
{
|
||||
poco_assert_dbg (DE_BOUND == _dataExtraction);
|
||||
poco_assert_dbg (pos < _values.size());
|
||||
poco_assert_dbg (pos < _lengths.size());
|
||||
poco_assert_dbg (pos < _lenLengths.size());
|
||||
|
||||
void prepareCharArray(std::size_t pos, SQLSMALLINT valueType, std::size_t size, std::size_t length);
|
||||
/// Utility function for preparation of bulk variable length character and BLOB columns.
|
||||
T* pArray = (T*) std::calloc(length * size, sizeof(T));
|
||||
|
||||
_values[pos] = Any(pArray);
|
||||
_lengths[pos] = 0;
|
||||
_lenLengths[pos].resize(length);
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) size,
|
||||
&_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
}
|
||||
|
||||
void prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, std::size_t length);
|
||||
/// Utility function for preparation of bulk bool columns.
|
||||
@@ -628,489 +676,513 @@ private:
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int8&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::Int8&)
|
||||
{
|
||||
prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::Int8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::Int8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::Int8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::Int8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::Int8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt8&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::UInt8&)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::UInt8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::UInt8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::UInt8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::UInt8>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::UInt8>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int16&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::Int16&)
|
||||
{
|
||||
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::Int16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::Int16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::Int16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::Int16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::Int16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt16&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::UInt16&)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::UInt16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::UInt16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::UInt16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::UInt16>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::UInt16>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int32&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::Int32&)
|
||||
{
|
||||
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::Int32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::Int32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::Int32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::Int32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::Int32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt32&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::UInt32&)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::UInt32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::UInt32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::UInt32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::UInt32>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::UInt32>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int64&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::Int64&)
|
||||
{
|
||||
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::Int64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::Int64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::Int64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt64&)
|
||||
inline void Preparator::prepare(std::size_t pos, Poco::UInt64&)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<Poco::UInt64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<Poco::UInt64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<Poco::UInt64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<Poco::UInt64>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<Poco::UInt64>& val)
|
||||
{
|
||||
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
inline void Preparation::prepare(std::size_t pos, long&)
|
||||
inline void Preparator::prepare(std::size_t pos, long&)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<long>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<long>& val)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<long>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<long>& val)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<long>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<long>& val)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, bool&)
|
||||
inline void Preparator::prepare(std::size_t pos, bool&)
|
||||
{
|
||||
prepareFixedSize<bool>(pos, SQL_C_BIT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<bool>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<bool>& val)
|
||||
{
|
||||
prepareBoolArray(pos, SQL_C_BIT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<bool>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<bool>& val)
|
||||
{
|
||||
prepareBoolArray(pos, SQL_C_BIT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<bool>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<bool>& val)
|
||||
{
|
||||
prepareBoolArray(pos, SQL_C_BIT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, float&)
|
||||
inline void Preparator::prepare(std::size_t pos, float&)
|
||||
{
|
||||
prepareFixedSize<float>(pos, SQL_C_FLOAT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<float>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<float>& val)
|
||||
{
|
||||
prepareFixedSize<float>(pos, SQL_C_FLOAT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<float>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<float>& val)
|
||||
{
|
||||
prepareFixedSize<float>(pos, SQL_C_FLOAT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<float>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<float>& val)
|
||||
{
|
||||
prepareFixedSize<float>(pos, SQL_C_FLOAT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, double&)
|
||||
inline void Preparator::prepare(std::size_t pos, double&)
|
||||
{
|
||||
prepareFixedSize<double>(pos, SQL_C_DOUBLE);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<double>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<double>& val)
|
||||
{
|
||||
prepareFixedSize<double>(pos, SQL_C_DOUBLE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<double>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<double>& val)
|
||||
{
|
||||
prepareFixedSize<double>(pos, SQL_C_DOUBLE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<double>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<double>& val)
|
||||
{
|
||||
prepareFixedSize<double>(pos, SQL_C_DOUBLE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, char&)
|
||||
inline void Preparator::prepare(std::size_t pos, char&)
|
||||
{
|
||||
prepareFixedSize<char>(pos, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::vector<char>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::vector<char>& val)
|
||||
{
|
||||
prepareFixedSize<char>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::deque<char>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::deque<char>& val)
|
||||
{
|
||||
prepareFixedSize<char>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, std::list<char>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, std::list<char>& val)
|
||||
{
|
||||
prepareFixedSize<char>(pos, SQL_C_STINYINT, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::string&)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::string&)
|
||||
{
|
||||
prepareVariableLen<char>(pos, SQL_C_CHAR, maxDataSize(pos), DT_CHAR);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<std::string>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<std::string>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<std::string>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<std::string>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<std::string>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<std::string>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::Data::BLOB&)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::Data::BLOB&)
|
||||
{
|
||||
prepareVariableLen<char>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
|
||||
prepareVariableLen<Poco::Data::BLOB::ValueType>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::BLOB>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::Data::BLOB>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_UCHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::Data::BLOB>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::Data::BLOB>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_UCHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::Data::BLOB>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::Data::BLOB>& val)
|
||||
{
|
||||
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
prepareCharArray<char, DT_UCHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::Data::Date&)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::Data::CLOB&)
|
||||
{
|
||||
prepareVariableLen<Poco::Data::CLOB::ValueType>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::Data::CLOB>& val)
|
||||
{
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::Data::CLOB>& val)
|
||||
{
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::Data::CLOB>& val)
|
||||
{
|
||||
prepareCharArray<char, DT_CHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::Data::Date&)
|
||||
{
|
||||
prepareFixedSize<SQL_DATE_STRUCT>(pos, SQL_C_TYPE_DATE);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::Date>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::Data::Date>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_DATE_STRUCT>(pos, SQL_C_TYPE_DATE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::Data::Date>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::Data::Date>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_DATE_STRUCT>(pos, SQL_C_TYPE_DATE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::Data::Date>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::Data::Date>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_DATE_STRUCT>(pos, SQL_C_TYPE_DATE, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::Data::Time&)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::Data::Time&)
|
||||
{
|
||||
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::Time>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::Data::Time>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::Data::Time>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::Data::Time>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::Data::Time>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::Data::Time>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::DateTime&)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::DateTime&)
|
||||
{
|
||||
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::DateTime>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::DateTime>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::DateTime>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::DateTime>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::DateTime>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::DateTime>& val)
|
||||
{
|
||||
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP, val.size());
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::Any& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::Any& val)
|
||||
{
|
||||
prepareImpl<std::vector<Poco::Any> >(pos);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Any>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::Any>& val)
|
||||
{
|
||||
prepareImpl<std::vector<Poco::Any> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::Any>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::Any>& val)
|
||||
{
|
||||
prepareImpl<std::deque<Poco::Any> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::Any>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::Any>& val)
|
||||
{
|
||||
prepareImpl<std::list<Poco::Any> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::DynamicAny& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const Poco::DynamicAny& val)
|
||||
{
|
||||
prepareImpl<std::vector<Poco::DynamicAny> >(pos);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::DynamicAny>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::vector<Poco::DynamicAny>& val)
|
||||
{
|
||||
prepareImpl<std::vector<Poco::DynamicAny> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::DynamicAny>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::deque<Poco::DynamicAny>& val)
|
||||
{
|
||||
prepareImpl<std::deque<Poco::DynamicAny> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::DynamicAny>& val)
|
||||
inline void Preparator::prepare(std::size_t pos, const std::list<Poco::DynamicAny>& val)
|
||||
{
|
||||
prepareImpl<std::list<Poco::DynamicAny> >(pos, &val);
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::bulkSize(std::size_t col) const
|
||||
inline std::size_t Preparator::bulkSize(std::size_t col) const
|
||||
{
|
||||
poco_assert (col < _lenLengths.size());
|
||||
|
||||
@@ -1118,31 +1190,31 @@ inline std::size_t Preparation::bulkSize(std::size_t col) const
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::setMaxFieldSize(std::size_t size)
|
||||
inline void Preparator::setMaxFieldSize(std::size_t size)
|
||||
{
|
||||
_maxFieldSize = size;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::getMaxFieldSize() const
|
||||
inline std::size_t Preparator::getMaxFieldSize() const
|
||||
{
|
||||
return _maxFieldSize;
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::setDataExtraction(Preparation::DataExtraction ext)
|
||||
inline void Preparator::setDataExtraction(Preparator::DataExtraction ext)
|
||||
{
|
||||
_dataExtraction = ext;
|
||||
}
|
||||
|
||||
|
||||
inline Preparation::DataExtraction Preparation::getDataExtraction() const
|
||||
inline Preparator::DataExtraction Preparator::getDataExtraction() const
|
||||
{
|
||||
return _dataExtraction;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Any& Preparation::operator [] (std::size_t pos)
|
||||
inline Poco::Any& Preparator::operator [] (std::size_t pos)
|
||||
{
|
||||
return _values.at(pos);
|
||||
}
|
||||
@@ -1151,4 +1223,4 @@ inline Poco::Any& Preparation::operator [] (std::size_t pos)
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Preparation_INCLUDED
|
||||
#endif // Data_ODBC_Preparator_INCLUDED
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Exception.h"
|
||||
@@ -147,40 +147,6 @@ void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const BLOB& val, Direction dir)
|
||||
{
|
||||
if (isOutBound(dir) || !isInBound(dir))
|
||||
throw NotImplementedException("BLOB parameter type can only be inbound.");
|
||||
|
||||
SQLPOINTER pVal = (SQLPOINTER) val.rawContent();
|
||||
SQLINTEGER size = (SQLINTEGER) val.size();
|
||||
|
||||
_inParams.insert(ParamMap::value_type(pVal, size));
|
||||
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
*pLenIn = size;
|
||||
|
||||
if (PB_AT_EXEC == _paramBinding)
|
||||
*pLenIn = SQL_LEN_DATA_AT_EXEC(size);
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
pVal,
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(BLOB)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const Date& val, Direction dir)
|
||||
{
|
||||
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
@@ -55,10 +55,10 @@ const std::string Extractor::FLD_SIZE_EXCEEDED_FMT = "Specified data size (%z by
|
||||
|
||||
|
||||
Extractor::Extractor(const StatementHandle& rStmt,
|
||||
Preparation& rPreparation):
|
||||
Preparator& rPreparator):
|
||||
_rStmt(rStmt),
|
||||
_rPreparation(rPreparation),
|
||||
_dataExtraction(rPreparation.getDataExtraction())
|
||||
_rPreparator(rPreparator),
|
||||
_dataExtraction(rPreparator.getDataExtraction())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
char* sp = AnyCast<char*>(_rPreparation[pos]);
|
||||
std::size_t dataSize = _rPreparator.actualDataSize(pos);
|
||||
char* sp = AnyCast<char*>(_rPreparator[pos]);
|
||||
std::size_t len = std::strlen(sp);
|
||||
if (len < dataSize) dataSize = len;
|
||||
checkDataSize(dataSize);
|
||||
@@ -84,127 +84,11 @@ bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<std::string> >(std::size_t pos,
|
||||
std::vector<std::string>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = columnSize(pos);
|
||||
std::vector<std::string>::iterator it = values.begin();
|
||||
std::vector<std::string>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assign(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<std::string> >(std::size_t pos,
|
||||
std::deque<std::string>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = columnSize(pos);
|
||||
std::deque<std::string>::iterator it = values.begin();
|
||||
std::deque<std::string>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assign(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<std::string> >(std::size_t pos,
|
||||
std::list<std::string>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = columnSize(pos);
|
||||
std::list<std::string>::iterator it = values.begin();
|
||||
std::list<std::string>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assign(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImpl<Poco::Data::BLOB>(std::size_t pos, Poco::Data::BLOB& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
char* sp = AnyCast<char*>(_rPreparation[pos]);
|
||||
val.assignRaw(sp, dataSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::BLOB> >(std::size_t pos,
|
||||
std::vector<Poco::Data::BLOB>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = _rPreparation.maxDataSize(pos);
|
||||
std::vector<Poco::Data::BLOB>::iterator it = values.begin();
|
||||
std::vector<Poco::Data::BLOB>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assignRaw(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::BLOB> >(std::size_t pos,
|
||||
std::deque<Poco::Data::BLOB>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = _rPreparation.maxDataSize(pos);
|
||||
std::deque<Poco::Data::BLOB>::iterator it = values.begin();
|
||||
std::deque<Poco::Data::BLOB>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assignRaw(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::BLOB> >(std::size_t pos,
|
||||
std::list<Poco::Data::BLOB>& values)
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_rPreparation[pos]);
|
||||
poco_assert_dbg (pc);
|
||||
poco_assert_dbg (_rPreparation.bulkSize() == values.size());
|
||||
std::size_t colWidth = _rPreparation.maxDataSize(pos);
|
||||
std::list<Poco::Data::BLOB>::iterator it = values.begin();
|
||||
std::list<Poco::Data::BLOB>::iterator end = values.end();
|
||||
for (int row = 0; it != end; ++it, ++row)
|
||||
it->assignRaw(*pc + row * colWidth, _rPreparation.actualDataSize(pos, row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImpl<Poco::Data::Date>(std::size_t pos, Poco::Data::Date& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
SQL_DATE_STRUCT& ds = *AnyCast<SQL_DATE_STRUCT>(&_rPreparation[pos]);
|
||||
SQL_DATE_STRUCT& ds = *AnyCast<SQL_DATE_STRUCT>(&_rPreparator[pos]);
|
||||
Utility::dateSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -214,7 +98,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::size_t pos,
|
||||
std::vector<Poco::Data::Date>& val)
|
||||
{
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -224,7 +108,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Date> >(std::size_t pos,
|
||||
std::deque<Poco::Data::Date>& val)
|
||||
{
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -234,7 +118,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Date> >(std::size_t pos,
|
||||
std::list<Poco::Data::Date>& val)
|
||||
{
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -245,9 +129,9 @@ bool Extractor::extractBoundImpl<Poco::Data::Time>(std::size_t pos, Poco::Data::
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
std::size_t dataSize = _rPreparator.actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
SQL_TIME_STRUCT& ts = *AnyCast<SQL_TIME_STRUCT>(&_rPreparation[pos]);
|
||||
SQL_TIME_STRUCT& ts = *AnyCast<SQL_TIME_STRUCT>(&_rPreparator[pos]);
|
||||
Utility::timeSync(val, ts);
|
||||
|
||||
return true;
|
||||
@@ -258,7 +142,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Time> >(std::size_t pos,
|
||||
std::vector<Poco::Data::Time>& val)
|
||||
{
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::timeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -268,7 +152,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Time> >(std::size_t pos,
|
||||
std::deque<Poco::Data::Time>& val)
|
||||
{
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::timeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -278,7 +162,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Time> >(std::size_t pos,
|
||||
std::list<Poco::Data::Time>& val)
|
||||
{
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::timeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -289,9 +173,9 @@ bool Extractor::extractBoundImpl<Poco::DateTime>(std::size_t pos, Poco::DateTime
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
std::size_t dataSize = _rPreparator.actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
SQL_TIMESTAMP_STRUCT& tss = *AnyCast<SQL_TIMESTAMP_STRUCT>(&_rPreparation[pos]);
|
||||
SQL_TIMESTAMP_STRUCT& tss = *AnyCast<SQL_TIMESTAMP_STRUCT>(&_rPreparator[pos]);
|
||||
Utility::dateTimeSync(val, tss);
|
||||
|
||||
return true;
|
||||
@@ -302,7 +186,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<Poco::DateTime> >(std::size_t pos,
|
||||
std::vector<Poco::DateTime>& val)
|
||||
{
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateTimeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -312,7 +196,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<Poco::DateTime> >(std::size_t pos,
|
||||
std::deque<Poco::DateTime>& val)
|
||||
{
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateTimeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -322,7 +206,7 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<Poco::DateTime> >(std::size_t pos,
|
||||
std::list<Poco::DateTime>& val)
|
||||
{
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparation[pos]);
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
|
||||
Utility::dateTimeSync(val, ds);
|
||||
return true;
|
||||
}
|
||||
@@ -332,8 +216,8 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::vector<bool> >(std::size_t pos,
|
||||
std::vector<bool>& val)
|
||||
{
|
||||
std::size_t length = _rPreparation.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparation[pos]);
|
||||
std::size_t length = _rPreparator.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
|
||||
val.assign(*p, *p + length);
|
||||
return true;
|
||||
}
|
||||
@@ -343,8 +227,8 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::deque<bool> >(std::size_t pos,
|
||||
std::deque<bool>& val)
|
||||
{
|
||||
std::size_t length = _rPreparation.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparation[pos]);
|
||||
std::size_t length = _rPreparator.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
|
||||
val.assign(*p, *p + length);
|
||||
return true;
|
||||
}
|
||||
@@ -354,8 +238,8 @@ template<>
|
||||
bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
|
||||
std::list<bool>& val)
|
||||
{
|
||||
std::size_t length = _rPreparation.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparation[pos]);
|
||||
std::size_t length = _rPreparator.getLength();
|
||||
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
|
||||
val.assign(*p, *p + length);
|
||||
return true;
|
||||
}
|
||||
@@ -364,7 +248,7 @@ bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
|
||||
template<>
|
||||
bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val, SQLSMALLINT cType)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
std::size_t maxSize = _rPreparator.getMaxFieldSize();
|
||||
std::size_t fetchedSize = 0;
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
@@ -416,11 +300,11 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractManualImpl<Poco::Data::BLOB>(std::size_t pos,
|
||||
Poco::Data::BLOB& val,
|
||||
bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
|
||||
Poco::Data::CLOB& val,
|
||||
SQLSMALLINT cType)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
std::size_t maxSize = _rPreparator.getMaxFieldSize();
|
||||
std::size_t fetchedSize = 0;
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
@@ -553,7 +437,7 @@ bool Extractor::extractManualImpl<Poco::DateTime>(std::size_t pos,
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SLONG);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -562,7 +446,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -571,7 +455,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -580,7 +464,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -589,7 +473,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SBIGINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -598,7 +482,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -607,7 +491,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -616,7 +500,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -626,7 +510,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SLONG);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -635,7 +519,7 @@ bool Extractor::extract(std::size_t pos, long& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<long>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -644,7 +528,7 @@ bool Extractor::extract(std::size_t pos, std::vector<long>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<long>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -653,7 +537,7 @@ bool Extractor::extract(std::size_t pos, std::deque<long>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<long>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -663,7 +547,7 @@ bool Extractor::extract(std::size_t pos, std::list<long>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, double& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_DOUBLE);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -672,7 +556,7 @@ bool Extractor::extract(std::size_t pos, double& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<double>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -681,7 +565,7 @@ bool Extractor::extract(std::size_t pos, std::vector<double>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<double>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -690,7 +574,7 @@ bool Extractor::extract(std::size_t pos, std::deque<double>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<double>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -699,7 +583,7 @@ bool Extractor::extract(std::size_t pos, std::list<double>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::string& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_CHAR);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -708,7 +592,7 @@ bool Extractor::extract(std::size_t pos, std::string& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -717,7 +601,7 @@ bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -726,7 +610,7 @@ bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -735,7 +619,16 @@ bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_BINARY);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Data::CLOB& val)
|
||||
{
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_BINARY);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -744,7 +637,7 @@ bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -753,7 +646,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -762,7 +655,34 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::BLOB>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val)
|
||||
{
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val)
|
||||
{
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::CLOB>& val)
|
||||
{
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -771,7 +691,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Data::BLOB>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Data::Date& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_TYPE_DATE);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -780,7 +700,7 @@ bool Extractor::extract(std::size_t pos, Poco::Data::Date& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Date>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -789,7 +709,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Date>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -798,7 +718,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Date>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -807,7 +727,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Date>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Data::Time& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_TYPE_TIME);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -816,7 +736,7 @@ bool Extractor::extract(std::size_t pos, Poco::Data::Time& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Time>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -825,7 +745,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Time>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -834,7 +754,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Time>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -843,7 +763,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Time>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::DateTime& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_TYPE_TIMESTAMP);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -852,7 +772,7 @@ bool Extractor::extract(std::size_t pos, Poco::DateTime& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::DateTime>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -861,7 +781,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::DateTime>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -870,7 +790,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::DateTime>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -879,7 +799,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::DateTime>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_STINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -888,7 +808,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -897,7 +817,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -906,7 +826,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -915,7 +835,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_UTINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -924,7 +844,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -933,7 +853,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -942,7 +862,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -951,7 +871,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SSHORT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -960,7 +880,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -969,7 +889,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -978,7 +898,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -987,7 +907,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_USHORT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -996,7 +916,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1005,7 +925,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1014,7 +934,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1023,7 +943,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_ULONG);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -1032,7 +952,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1041,7 +961,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1050,7 +970,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1059,7 +979,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SBIGINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -1068,7 +988,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1077,7 +997,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1086,7 +1006,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1095,7 +1015,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, bool& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_BIT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -1104,7 +1024,7 @@ bool Extractor::extract(std::size_t pos, bool& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<bool>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1113,7 +1033,7 @@ bool Extractor::extract(std::size_t pos, std::vector<bool>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1122,7 +1042,7 @@ bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<bool>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1131,7 +1051,7 @@ bool Extractor::extract(std::size_t pos, std::list<bool>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, float& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_FLOAT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -1140,7 +1060,7 @@ bool Extractor::extract(std::size_t pos, float& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<float>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1149,7 +1069,7 @@ bool Extractor::extract(std::size_t pos, std::vector<float>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<float>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1158,7 +1078,7 @@ bool Extractor::extract(std::size_t pos, std::deque<float>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<float>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1167,7 +1087,7 @@ bool Extractor::extract(std::size_t pos, std::list<float>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, char& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_STINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
@@ -1176,7 +1096,7 @@ bool Extractor::extract(std::size_t pos, char& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<char>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1185,7 +1105,7 @@ bool Extractor::extract(std::size_t pos, std::vector<char>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<char>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1194,7 +1114,7 @@ bool Extractor::extract(std::size_t pos, std::deque<char>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<char>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImplContainer(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1209,7 +1129,7 @@ bool Extractor::extract(std::size_t pos, Poco::Any& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1218,7 +1138,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1227,7 +1147,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Any>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1242,7 +1162,7 @@ bool Extractor::extract(std::size_t pos, Poco::DynamicAny& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::DynamicAny>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1251,7 +1171,7 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::DynamicAny>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::DynamicAny>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1260,7 +1180,7 @@ bool Extractor::extract(std::size_t pos, std::deque<Poco::DynamicAny>& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::DynamicAny>& val)
|
||||
{
|
||||
if (Preparation::DE_BOUND == _dataExtraction)
|
||||
if (Preparator::DE_BOUND == _dataExtraction)
|
||||
return extractBoundImpl(pos, val);
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
@@ -1269,7 +1189,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::DynamicAny>& val)
|
||||
|
||||
bool Extractor::isNull(std::size_t col, std::size_t row)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1280,13 +1200,13 @@ bool Extractor::isNull(std::size_t col, std::size_t row)
|
||||
}
|
||||
}
|
||||
else
|
||||
return SQL_NULL_DATA == _rPreparation.actualDataSize(col, row);
|
||||
return SQL_NULL_DATA == _rPreparator.actualDataSize(col, row);
|
||||
}
|
||||
|
||||
|
||||
void Extractor::checkDataSize(std::size_t size)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
std::size_t maxSize = _rPreparator.getMaxFieldSize();
|
||||
if (size > maxSize)
|
||||
throw DataException(format(FLD_SIZE_EXCEEDED_FMT, size, maxSize));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "Poco/Data/ODBC/ConnectionHandle.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/AbstractPrepare.h"
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ void ODBCStatementImpl::compileImpl()
|
||||
_nextResponse = 0;
|
||||
|
||||
if (_preparations.size())
|
||||
PreparationVec().swap(_preparations);
|
||||
PreparatorVec().swap(_preparations);
|
||||
|
||||
addPreparation();
|
||||
addPreparator();
|
||||
|
||||
Binder::ParameterBinding bind = session().getFeature("autoBind") ?
|
||||
Binder::PB_IMMEDIATE : Binder::PB_AT_EXEC;
|
||||
@@ -136,7 +136,7 @@ void ODBCStatementImpl::makeInternalExtractors()
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::addPreparation()
|
||||
void ODBCStatementImpl::addPreparator()
|
||||
{
|
||||
if (0 == _preparations.size())
|
||||
{
|
||||
@@ -144,15 +144,15 @@ void ODBCStatementImpl::addPreparation()
|
||||
if (statement.empty())
|
||||
throw ODBCException("Empty statements are illegal");
|
||||
|
||||
Preparation::DataExtraction ext = session().getFeature("autoExtract") ?
|
||||
Preparation::DE_BOUND : Preparation::DE_MANUAL;
|
||||
Preparator::DataExtraction ext = session().getFeature("autoExtract") ?
|
||||
Preparator::DE_BOUND : Preparator::DE_MANUAL;
|
||||
|
||||
std::size_t maxFieldSize = AnyCast<std::size_t>(session().getProperty("maxFieldSize"));
|
||||
|
||||
_preparations.push_back(new Preparation(_stmt, statement, maxFieldSize, ext));
|
||||
_preparations.push_back(new Preparator(_stmt, statement, maxFieldSize, ext));
|
||||
}
|
||||
else
|
||||
_preparations.push_back(new Preparation(*_preparations[0]));
|
||||
_preparations.push_back(new Preparator(*_preparations[0]));
|
||||
|
||||
_extractors.push_back(new Extractor(_stmt, *_preparations.back()));
|
||||
}
|
||||
@@ -180,7 +180,7 @@ void ODBCStatementImpl::doPrepare()
|
||||
|
||||
for (std::size_t pos = 0; it != itEnd; ++it)
|
||||
{
|
||||
AbstractPrepare* pAP = (*it)->createPrepareObject(_preparations[curDataSet], pos);
|
||||
AbstractPreparation* pAP = (*it)->createPreparation(_preparations[curDataSet], pos);
|
||||
pAP->prepare();
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
delete pAP;
|
||||
@@ -312,7 +312,7 @@ bool ODBCStatementImpl::hasNext()
|
||||
if (SQL_NO_DATA == SQLMoreResults(_stmt))
|
||||
return false;
|
||||
|
||||
addPreparation();
|
||||
addPreparator();
|
||||
doPrepare();
|
||||
fixupExtraction();
|
||||
makeStep();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//
|
||||
// Preparation.cpp
|
||||
// Preparator.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/src/Preparation.cpp#5 $
|
||||
// $Id: //poco/Main/Data/ODBC/src/Preparator.cpp#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: Preparation
|
||||
// Module: Preparator
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,7 +34,7 @@
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Preparation::Preparation(const StatementHandle& rStmt,
|
||||
Preparator::Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction):
|
||||
@@ -61,7 +61,7 @@ Preparation::Preparation(const StatementHandle& rStmt,
|
||||
}
|
||||
|
||||
|
||||
Preparation::Preparation(const Preparation& other):
|
||||
Preparator::Preparator(const Preparator& other):
|
||||
_rStmt(other._rStmt),
|
||||
_maxFieldSize(other._maxFieldSize),
|
||||
_dataExtraction(other._dataExtraction)
|
||||
@@ -70,13 +70,13 @@ Preparation::Preparation(const Preparation& other):
|
||||
}
|
||||
|
||||
|
||||
Preparation::~Preparation()
|
||||
Preparator::~Preparator()
|
||||
{
|
||||
freeMemory();
|
||||
}
|
||||
|
||||
|
||||
void Preparation::freeMemory() const
|
||||
void Preparator::freeMemory() const
|
||||
{
|
||||
IndexMap::iterator it = _varLengthArrays.begin();
|
||||
IndexMap::iterator end = _varLengthArrays.end();
|
||||
@@ -92,6 +92,10 @@ void Preparation::freeMemory() const
|
||||
deleteCachedArray<char>(it->first);
|
||||
break;
|
||||
|
||||
case DT_UCHAR:
|
||||
deleteCachedArray<unsigned char>(it->first);
|
||||
break;
|
||||
|
||||
case DT_CHAR_ARRAY:
|
||||
{
|
||||
char** pc = AnyCast<char*>(&_values[it->first]);
|
||||
@@ -99,6 +103,13 @@ void Preparation::freeMemory() const
|
||||
break;
|
||||
}
|
||||
|
||||
case DT_UCHAR_ARRAY:
|
||||
{
|
||||
unsigned char** pc = AnyCast<unsigned char*>(&_values[it->first]);
|
||||
if (pc) std::free(*pc);
|
||||
break;
|
||||
}
|
||||
|
||||
case DT_BOOL_ARRAY:
|
||||
{
|
||||
bool** pb = AnyCast<bool*>(&_values[it->first]);
|
||||
@@ -113,14 +124,14 @@ void Preparation::freeMemory() const
|
||||
}
|
||||
|
||||
|
||||
std::size_t Preparation::columns() const
|
||||
std::size_t Preparator::columns() const
|
||||
{
|
||||
if (_values.empty()) resize();
|
||||
return _values.size();
|
||||
}
|
||||
|
||||
|
||||
void Preparation::resize() const
|
||||
void Preparator::resize() const
|
||||
{
|
||||
SQLSMALLINT nCol = 0;
|
||||
if (!Utility::isError(SQLNumResultCols(_rStmt, &nCol)) && 0 != nCol)
|
||||
@@ -137,7 +148,7 @@ void Preparation::resize() const
|
||||
}
|
||||
|
||||
|
||||
std::size_t Preparation::maxDataSize(std::size_t pos) const
|
||||
std::size_t Preparator::maxDataSize(std::size_t pos) const
|
||||
{
|
||||
poco_assert_dbg (pos < _values.size());
|
||||
|
||||
@@ -160,7 +171,7 @@ std::size_t Preparation::maxDataSize(std::size_t pos) const
|
||||
}
|
||||
|
||||
|
||||
std::size_t Preparation::actualDataSize(std::size_t col, std::size_t row) const
|
||||
std::size_t Preparator::actualDataSize(std::size_t col, std::size_t row) const
|
||||
{
|
||||
SQLLEN size = (POCO_DATA_INVALID_ROW == row) ? _lengths.at(col) :
|
||||
_lenLengths.at(col).at(row);
|
||||
@@ -172,33 +183,7 @@ std::size_t Preparation::actualDataSize(std::size_t col, std::size_t row) const
|
||||
}
|
||||
|
||||
|
||||
void Preparation::prepareCharArray(std::size_t pos, SQLSMALLINT valueType, std::size_t size, std::size_t length)
|
||||
{
|
||||
poco_assert_dbg (DE_BOUND == _dataExtraction);
|
||||
poco_assert_dbg (pos < _values.size());
|
||||
poco_assert_dbg (pos < _lengths.size());
|
||||
poco_assert_dbg (pos < _lenLengths.size());
|
||||
|
||||
char* pArray = (char*) std::calloc(length * size, sizeof(char));
|
||||
|
||||
_values[pos] = Any(pArray);
|
||||
_lengths[pos] = 0;
|
||||
_lenLengths[pos].resize(length);
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT_CHAR_ARRAY));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) size,
|
||||
&_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Preparation::prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, std::size_t length)
|
||||
void Preparator::prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, std::size_t length)
|
||||
{
|
||||
poco_assert_dbg (DE_BOUND == _dataExtraction);
|
||||
poco_assert_dbg (pos < _values.size());
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
|
||||
@@ -50,7 +50,7 @@ using namespace Poco::Data::Keywords;
|
||||
using Poco::Data::DataException;
|
||||
using Poco::Data::Statement;
|
||||
using Poco::Data::RecordSet;
|
||||
using Poco::Data::BLOB;
|
||||
using Poco::Data::CLOB;
|
||||
using Poco::Data::ODBC::Utility;
|
||||
using Poco::Data::ODBC::ConnectionException;
|
||||
using Poco::Data::ODBC::StatementException;
|
||||
@@ -237,7 +237,7 @@ void ODBCSQLServerTest::testBulk()
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulkWithBool<std::vector<int>,
|
||||
std::vector<std::string>,
|
||||
std::vector<BLOB>,
|
||||
std::vector<CLOB>,
|
||||
std::vector<double>,
|
||||
std::vector<DateTime>,
|
||||
std::vector<bool> >(100, "CONVERT(VARBINARY(30),?)");
|
||||
@@ -245,7 +245,7 @@ void ODBCSQLServerTest::testBulk()
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulkWithBool<std::deque<int>,
|
||||
std::deque<std::string>,
|
||||
std::deque<BLOB>,
|
||||
std::deque<CLOB>,
|
||||
std::deque<double>,
|
||||
std::deque<DateTime>,
|
||||
std::deque<bool> >(100, "CONVERT(VARBINARY(30),?)");
|
||||
@@ -253,7 +253,7 @@ void ODBCSQLServerTest::testBulk()
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulkWithBool<std::list<int>,
|
||||
std::list<std::string>,
|
||||
std::list<BLOB>,
|
||||
std::list<CLOB>,
|
||||
std::list<double>,
|
||||
std::list<DateTime>,
|
||||
std::list<bool> >(100, "CONVERT(VARBINARY(30),?)");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
using namespace Poco::Data::Keywords;
|
||||
using Poco::Data::Session;
|
||||
using Poco::Data::BLOB;
|
||||
using Poco::Data::CLOB;
|
||||
using Poco::Data::ODBC::Utility;
|
||||
using Poco::Data::ODBC::ODBCException;
|
||||
using Poco::Data::ODBC::ConnectionException;
|
||||
@@ -464,21 +464,21 @@ void ODBCTest::testBulk()
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulk<std::vector<int>,
|
||||
std::vector<std::string>,
|
||||
std::vector<BLOB>,
|
||||
std::vector<CLOB>,
|
||||
std::vector<double>,
|
||||
std::vector<DateTime> >(100);
|
||||
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulk<std::deque<int>,
|
||||
std::deque<std::string>,
|
||||
std::deque<BLOB>,
|
||||
std::deque<CLOB>,
|
||||
std::deque<double>,
|
||||
std::deque<DateTime> >(100);
|
||||
|
||||
recreateMiscTable();
|
||||
_pExecutor->doBulk<std::list<int>,
|
||||
std::list<std::string>,
|
||||
std::list<BLOB>,
|
||||
std::list<CLOB>,
|
||||
std::list<double>,
|
||||
std::list<DateTime> >(100);
|
||||
}
|
||||
@@ -804,11 +804,11 @@ void ODBCTest::testBLOBContainer()
|
||||
session().setFeature("autoBind", bindValue(i));
|
||||
session().setFeature("autoExtract", bindValue(i+1));
|
||||
recreatePersonBLOBTable();
|
||||
_pExecutor->blobContainer<std::vector<std::string>, std::vector<BLOB> >(10);
|
||||
_pExecutor->blobContainer<std::vector<std::string>, std::vector<CLOB> >(10);
|
||||
recreatePersonBLOBTable();
|
||||
_pExecutor->blobContainer<std::deque<std::string>, std::deque<BLOB> >(10);
|
||||
_pExecutor->blobContainer<std::deque<std::string>, std::deque<CLOB> >(10);
|
||||
recreatePersonBLOBTable();
|
||||
_pExecutor->blobContainer<std::list<std::string>, std::list<BLOB> >(10);
|
||||
_pExecutor->blobContainer<std::list<std::string>, std::list<CLOB> >(10);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/Time.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/RecordSet.h"
|
||||
#include "Poco/Data/RowIterator.h"
|
||||
@@ -60,7 +60,7 @@
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/ODBC/ODBCStatementImpl.h"
|
||||
#include <sqltypes.h>
|
||||
@@ -80,11 +80,11 @@ using Poco::Data::RowIterator;
|
||||
using Poco::Data::SQLChannel;
|
||||
using Poco::Data::LimitException;
|
||||
using Poco::Data::BindingException;
|
||||
using Poco::Data::BLOB;
|
||||
using Poco::Data::CLOB;
|
||||
using Poco::Data::Date;
|
||||
using Poco::Data::Time;
|
||||
using Poco::Data::ODBC::Utility;
|
||||
using Poco::Data::ODBC::Preparation;
|
||||
using Poco::Data::ODBC::Preparator;
|
||||
using Poco::Data::ODBC::ConnectionException;
|
||||
using Poco::Data::ODBC::StatementException;
|
||||
using Poco::Data::ODBC::DataTruncatedException;
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
pBinder->bind(pos++, obj.age, dir);
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, Person& obj, AbstractPreparation* pPrepare)
|
||||
static void prepare(std::size_t pos, Person& obj, AbstractPreparator* pPrepare)
|
||||
{
|
||||
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
|
||||
poco_assert_dbg (pPrepare != 0);
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
pBinder->bind(pos++, obj.age, dir);
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, RefCountedPerson& obj, AbstractPreparation* pPrepare)
|
||||
static void prepare(std::size_t pos, RefCountedPerson& obj, AbstractPreparator* pPrepare)
|
||||
{
|
||||
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
|
||||
poco_assert_dbg (pPrepare != 0);
|
||||
@@ -2348,7 +2348,7 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder)
|
||||
std::string firstName("firstname");
|
||||
std::string address("Address");
|
||||
|
||||
BLOB img("0123456789", 10);
|
||||
CLOB img("0123456789", 10);
|
||||
int count = 0;
|
||||
try { session() << format("INSERT INTO Person VALUES (?,?,?,%s)", blobPlaceholder),
|
||||
use(lastName), use(firstName), use(address), use(img), now; }
|
||||
@@ -2359,14 +2359,14 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder)
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assert (count == 1);
|
||||
|
||||
BLOB res;
|
||||
CLOB res;
|
||||
assert (res.size() == 0);
|
||||
try { session() << "SELECT Image FROM Person", into(res), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assert (res == img);
|
||||
|
||||
BLOB big;
|
||||
CLOB big;
|
||||
std::vector<char> v(bigSize, 'x');
|
||||
big.assignRaw(&v[0], v.size());
|
||||
|
||||
@@ -2394,7 +2394,7 @@ void SQLExecutor::blobStmt()
|
||||
std::string lastName("lastname");
|
||||
std::string firstName("firstname");
|
||||
std::string address("Address");
|
||||
BLOB blob("0123456789", 10);
|
||||
CLOB blob("0123456789", 10);
|
||||
|
||||
int count = 0;
|
||||
Statement ins = (session() << "INSERT INTO PERSON VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(blob));
|
||||
@@ -2404,7 +2404,7 @@ void SQLExecutor::blobStmt()
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assert (count == 1);
|
||||
|
||||
BLOB res;
|
||||
CLOB res;
|
||||
poco_assert (res.size() == 0);
|
||||
Statement stmt = (session() << "SELECT Image FROM Person", into(res));
|
||||
try { stmt.execute(); }
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
using Poco::Data::Keywords::use; \
|
||||
using Poco::Data::Keywords::bulk; \
|
||||
using Poco::Data::Keywords::limit; \
|
||||
using Poco::Data::BLOB; \
|
||||
using Poco::Data::CLOB; \
|
||||
using Poco::Data::ODBC::ConnectionException; \
|
||||
using Poco::Data::ODBC::StatementException
|
||||
|
||||
@@ -241,8 +241,8 @@ public:
|
||||
assert (size - 1 == ints.back());
|
||||
assert (std::string("xyz0") == strings.front());
|
||||
assert (std::string("xyz") + number == strings.back());
|
||||
assert (BLOB("abc0") == blobs.front());
|
||||
BLOB blob("abc");
|
||||
assert (CLOB("abc0") == blobs.front());
|
||||
CLOB blob("abc");
|
||||
blob.appendRaw(number.c_str(), number.size());
|
||||
assert (blob == blobs.back());
|
||||
assert (.5 == floats.front());
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
assert (size - 1 == ints.back());
|
||||
assert (std::string("xyz0") == strings.front());
|
||||
assert (std::string("xyz") + number == strings.back());
|
||||
assert (BLOB("abc0") == blobs.front());
|
||||
assert (CLOB("abc0") == blobs.front());
|
||||
blob.assignRaw("abc", 3);
|
||||
blob.appendRaw(number.c_str(), number.size());
|
||||
assert (blob == blobs.back());
|
||||
@@ -376,8 +376,8 @@ public:
|
||||
assert (size - 1 == ints.back());
|
||||
assert (std::string("xyz0") == strings.front());
|
||||
assert (std::string("xyz") + number == strings.back());
|
||||
assert (BLOB("abc0") == blobs.front());
|
||||
BLOB blob("abc");
|
||||
assert (CLOB("abc0") == blobs.front());
|
||||
CLOB blob("abc");
|
||||
blob.appendRaw(number.c_str(), number.size());
|
||||
assert (blob == blobs.back());
|
||||
assert (.5 == floats.front());
|
||||
@@ -422,7 +422,7 @@ public:
|
||||
assert (size - 1 == ints.back());
|
||||
assert (std::string("xyz0") == strings.front());
|
||||
assert (std::string("xyz") + number == strings.back());
|
||||
assert (BLOB("abc0") == blobs.front());
|
||||
assert (CLOB("abc0") == blobs.front());
|
||||
blob.assignRaw("abc", 3);
|
||||
blob.appendRaw(number.c_str(), number.size());
|
||||
assert (blob == blobs.back());
|
||||
@@ -461,7 +461,7 @@ public:
|
||||
C1 lastName(size, "lastname");
|
||||
C1 firstName(size, "firstname");
|
||||
C1 address(size, "Address");
|
||||
C2 img(size, BLOB("0123456789", 10));
|
||||
C2 img(size, CLOB("0123456789", 10));
|
||||
int count = 0;
|
||||
try { session() << "INSERT INTO PERSON VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(img), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
|
||||
Reference in New Issue
Block a user