std::deque and std::list bulk support

This commit is contained in:
Aleksandar Fabijanic 2007-12-19 02:37:40 +00:00
parent 1c4e777ab3
commit 8c3d87b1c7
26 changed files with 3394 additions and 746 deletions

View File

@ -181,6 +181,15 @@
<File
RelativePath=".\src\BLOBStream.cpp">
</File>
<File
RelativePath=".\include\Poco\Data\Bulk.h">
</File>
<File
RelativePath=".\include\Poco\Data\BulkBinding.h">
</File>
<File
RelativePath=".\include\Poco\Data\BulkExtraction.h">
</File>
<File
RelativePath=".\include\Poco\Data\Column.h">
</File>
@ -208,6 +217,9 @@
<File
RelativePath=".\include\Poco\Data\MetaColumn.h">
</File>
<File
RelativePath=".\include\Poco\Data\Position.h">
</File>
<File
RelativePath=".\include\Poco\Data\Prepare.h">
</File>
@ -244,9 +256,6 @@
<File
RelativePath=".\include\Poco\Data\StatementImpl.h">
</File>
<File
RelativePath=".\include\Poco\Data\Step.h">
</File>
<File
RelativePath=".\include\Poco\Data\Time.h">
</File>
@ -281,6 +290,9 @@
<File
RelativePath=".\include\Poco\Data\BLOBStream.h">
</File>
<File
RelativePath=".\src\Bulk.cpp">
</File>
<File
RelativePath=".\src\Connector.cpp">
</File>
@ -296,6 +308,9 @@
<File
RelativePath=".\src\MetaColumn.cpp">
</File>
<File
RelativePath=".\src\Position.cpp">
</File>
<File
RelativePath=".\src\Range.cpp">
</File>
@ -329,9 +344,6 @@
<File
RelativePath=".\src\StatementImpl.cpp">
</File>
<File
RelativePath=".\src\Step.cpp">
</File>
<File
RelativePath=".\src\Time.cpp">
</File>

View File

@ -157,9 +157,6 @@
<File
RelativePath=".\include\Poco\Data\Odbc\Connector.h">
</File>
<File
RelativePath=".\include\Poco\Data\Odbc\TypeInfo.h">
</File>
<File
RelativePath=".\include\Poco\Data\Odbc\Diagnostics.h">
</File>
@ -196,6 +193,18 @@
<File
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
</File>
<File
RelativePath=".\include\Poco\Data\Odbc\TypeInfo.h">
</File>
<File
RelativePath=".\include\Poco\Data\ODBC\Unicode.h">
</File>
<File
RelativePath=".\include\Poco\Data\ODBC\Unicode_UNIX.h">
</File>
<File
RelativePath=".\include\Poco\Data\ODBC\Unicode_WIN32.h">
</File>
<File
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
</File>
@ -212,9 +221,6 @@
<File
RelativePath=".\src\Connector.cpp">
</File>
<File
RelativePath=".\src\TypeInfo.cpp">
</File>
<File
RelativePath=".\src\EnvironmentHandle.cpp">
</File>
@ -239,6 +245,42 @@
<File
RelativePath=".\src\SessionImpl.cpp">
</File>
<File
RelativePath=".\src\TypeInfo.cpp">
</File>
<File
RelativePath=".\src\Unicode.cpp">
</File>
<File
RelativePath=".\src\Unicode_UNIX.cpp">
<FileConfiguration
Name="debug_shared|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="release_shared|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\Unicode_WIN32.cpp">
<FileConfiguration
Name="debug_shared|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="release_shared|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\Utility.cpp">
</File>

File diff suppressed because it is too large Load Diff

View File

@ -80,54 +80,108 @@ public:
bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
/// Extracts an Int8 vector.
bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
/// Extracts an Int8 deque.
bool extract(std::size_t pos, std::list<Poco::Int8>& val);
/// Extracts an Int8 list.
bool extract(std::size_t pos, Poco::UInt8& val);
/// Extracts an UInt8.
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
/// Extracts an UInt8 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
/// Extracts an UInt8 deque.
bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
/// Extracts an UInt8 list.
bool extract(std::size_t pos, Poco::Int16& val);
/// Extracts an Int16.
bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
/// Extracts an Int16 vector.
bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
/// Extracts an Int16 deque.
bool extract(std::size_t pos, std::list<Poco::Int16>& val);
/// Extracts an Int16 list.
bool extract(std::size_t pos, Poco::UInt16& val);
/// Extracts an UInt16.
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
/// Extracts an UInt16 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
/// Extracts an UInt16 deque.
bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
/// Extracts an UInt16 list.
bool extract(std::size_t pos, Poco::Int32& val);
/// Extracts an Int32.
bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
/// Extracts an Int32 vector.
bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
/// Extracts an Int32 deque.
bool extract(std::size_t pos, std::list<Poco::Int32>& val);
/// Extracts an Int32 list.
bool extract(std::size_t pos, Poco::UInt32& val);
/// Extracts an UInt32.
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
/// Extracts an UInt32 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
/// Extracts an UInt32 deque.
bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
/// Extracts an UInt32 list.
bool extract(std::size_t pos, Poco::Int64& val);
/// Extracts an Int64.
bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
/// Extracts an Int64 vector.
bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
/// Extracts an Int64 deque.
bool extract(std::size_t pos, std::list<Poco::Int64>& val);
/// Extracts an Int64 list.
bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64.
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
/// Extracts an UInt64 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
/// Extracts an UInt64 deque.
bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
bool extract(std::size_t pos, long& val);
/// Extracts a long.
bool extract(std::size_t pos, std::vector<long>& val);
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<long>& val);
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list.
#endif
bool extract(std::size_t pos, bool& val);
@ -136,53 +190,107 @@ public:
bool extract(std::size_t pos, std::vector<bool>& val);
/// Extracts a boolean vector.
bool extract(std::size_t pos, std::deque<bool>& val);
/// Extracts a boolean deque.
bool extract(std::size_t pos, std::list<bool>& val);
/// Extracts a boolean list.
bool extract(std::size_t pos, float& val);
/// Extracts a float.
bool extract(std::size_t pos, std::vector<float>& val);
/// Extracts a float vector.
bool extract(std::size_t pos, std::deque<float>& val);
/// Extracts a float deque.
bool extract(std::size_t pos, std::list<float>& val);
/// Extracts a float list.
bool extract(std::size_t pos, double& val);
/// Extracts a double.
bool extract(std::size_t pos, std::vector<double>& val);
/// Extracts a double vector.
bool extract(std::size_t pos, std::deque<double>& val);
/// Extracts a double deque.
bool extract(std::size_t pos, std::list<double>& val);
/// Extracts a double list.
bool extract(std::size_t pos, char& val);
/// Extracts a single character.
bool extract(std::size_t pos, std::vector<char>& val);
/// Extracts a single character vector.
bool extract(std::size_t pos, std::deque<char>& val);
/// Extracts a single character deque.
bool extract(std::size_t pos, std::list<char>& val);
/// Extracts a single character list.
bool extract(std::size_t pos, std::string& val);
/// Extracts a string.
bool extract(std::size_t pos, std::vector<std::string>& val);
/// Extracts a string vector.
bool extract(std::size_t pos, std::deque<std::string>& val);
/// Extracts a string deque.
bool extract(std::size_t pos, std::list<std::string>& val);
/// Extracts a string list.
bool extract(std::size_t pos, Poco::Data::BLOB& val);
/// Extracts a BLOB.
bool extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val);
/// Extracts a BLOB vector.
bool extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val);
/// Extracts a BLOB deque.
bool extract(std::size_t pos, std::list<Poco::Data::BLOB>& val);
/// Extracts a BLOB list.
bool extract(std::size_t pos, Poco::Data::Date& val);
/// Extracts a Date.
bool extract(std::size_t pos, std::vector<Poco::Data::Date>& val);
/// Extracts a Date vector.
bool extract(std::size_t pos, std::deque<Poco::Data::Date>& val);
/// Extracts a Date deque.
bool extract(std::size_t pos, std::list<Poco::Data::Date>& val);
/// Extracts a Date list.
bool extract(std::size_t pos, Poco::Data::Time& val);
/// Extracts a Time.
bool extract(std::size_t pos, std::vector<Poco::Data::Time>& val);
/// Extracts a Time vector.
bool extract(std::size_t pos, std::deque<Poco::Data::Time>& val);
/// Extracts a Time deque.
bool extract(std::size_t pos, std::list<Poco::Data::Time>& val);
/// Extracts a Time list.
bool extract(std::size_t pos, Poco::DateTime& val);
/// Extracts a DateTime.
bool extract(std::size_t pos, std::vector<Poco::DateTime>& val);
/// Extracts a DateTime vector.
bool extract(std::size_t pos, std::deque<Poco::DateTime>& val);
/// Extracts a DateTime deque.
bool extract(std::size_t pos, std::list<Poco::DateTime>& val);
/// Extracts a DateTime list.
bool extract(std::size_t pos, Poco::Any& val);
/// Extracts an Any.
@ -190,12 +298,24 @@ public:
bool extract(std::size_t pos, std::vector<Poco::Any>& val);
/// Extracts an Any vector.
bool extract(std::size_t pos, std::deque<Poco::Any>& val);
/// Extracts an Any deque.
bool extract(std::size_t pos, std::list<Poco::Any>& val);
/// Extracts an Any list.
bool extract(std::size_t pos, Poco::DynamicAny& val);
/// Extracts a DynamicAny.
bool extract(std::size_t pos, std::vector<Poco::DynamicAny>& val);
/// Extracts a DynamicAny vector.
bool extract(std::size_t pos, std::deque<Poco::DynamicAny>& val);
/// Extracts a DynamicAny deque.
bool extract(std::size_t pos, std::list<Poco::DynamicAny>& val);
/// Extracts a DynamicAny list.
void setDataExtraction(Preparation::DataExtraction ext);
/// Set data extraction mode.
@ -236,11 +356,12 @@ private:
return true;
}
template<typename T>
bool extractBoundImplVec(std::size_t pos, std::vector<T>& val)
template<typename C>
bool extractBoundImplContainer(std::size_t pos, C& val)
{
poco_assert_dbg (typeid(std::vector<T>) == _rPreparation[pos].type());
std::vector<T>& v = RefAnyCast<std::vector<T> >(_rPreparation[pos]);
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]);
val.assign(v.begin(), v.end());
return true;
}

View File

@ -63,14 +63,12 @@ namespace Data {
class Date;
class Time;
class BLOB;
namespace ODBC {
class BLOB;
class ODBC_API Preparation : public AbstractPreparation
/// Class used for database preparation where we first have to register all data types
/// with respective memory output locations before extracting data.
@ -108,6 +106,7 @@ public:
enum DataType
{
DT_BOOL,
DT_BOOL_ARRAY,
DT_CHAR,
DT_CHAR_ARRAY,
DT_DATE,
@ -133,54 +132,108 @@ public:
void prepare(std::size_t pos, std::vector<Poco::Int8>& val);
/// Prepares an Int8 vector.
void prepare(std::size_t pos, std::deque<Poco::Int8>& val);
/// Prepares an Int8 deque.
void prepare(std::size_t pos, std::list<Poco::Int8>& val);
/// Prepares an Int8 list.
void prepare(std::size_t pos, Poco::UInt8& val);
/// Prepares an UInt8.
void prepare(std::size_t pos, std::vector<Poco::UInt8>& val);
/// Prepares an UInt8 vector.
void prepare(std::size_t pos, std::deque<Poco::UInt8>& val);
/// Prepares an UInt8 deque.
void prepare(std::size_t pos, std::list<Poco::UInt8>& val);
/// Prepares an UInt8 list.
void prepare(std::size_t pos, Poco::Int16& val);
/// Prepares an Int16.
void prepare(std::size_t pos, std::vector<Poco::Int16>& val);
/// Prepares an Int16 vector.
void prepare(std::size_t pos, std::deque<Poco::Int16>& val);
/// Prepares an Int16 deque.
void prepare(std::size_t pos, std::list<Poco::Int16>& val);
/// Prepares an Int16 list.
void prepare(std::size_t pos, Poco::UInt16& val);
/// Prepares an UInt16.
void prepare(std::size_t pos, std::vector<Poco::UInt16>& val);
/// Prepares an UInt16 vector.
void prepare(std::size_t pos, std::deque<Poco::UInt16>& val);
/// Prepares an UInt16 deque.
void prepare(std::size_t pos, std::list<Poco::UInt16>& val);
/// Prepares an UInt16 list.
void prepare(std::size_t pos, Poco::Int32& val);
/// Prepares an Int32.
void prepare(std::size_t pos, std::vector<Poco::Int32>& val);
/// Prepares an Int32 vector.
void prepare(std::size_t pos, std::deque<Poco::Int32>& val);
/// Prepares an Int32 deque.
void prepare(std::size_t pos, std::list<Poco::Int32>& val);
/// Prepares an Int32 list.
void prepare(std::size_t pos, Poco::UInt32& val);
/// Prepares an UInt32.
void prepare(std::size_t pos, std::vector<Poco::UInt32>& val);
/// Prepares an UInt32 vector.
void prepare(std::size_t pos, std::deque<Poco::UInt32>& val);
/// Prepares an UInt32 deque.
void prepare(std::size_t pos, std::list<Poco::UInt32>& val);
/// Prepares an UInt32 list.
void prepare(std::size_t pos, Poco::Int64& val);
/// Prepares an Int64.
void prepare(std::size_t pos, std::vector<Poco::Int64>& val);
/// Prepares an Int64 vector.
void prepare(std::size_t pos, std::deque<Poco::Int64>& val);
/// Prepares an Int64 deque.
void prepare(std::size_t pos, std::list<Poco::Int64>& val);
/// Prepares an Int64 list.
void prepare(std::size_t pos, Poco::UInt64& val);
/// Prepares an UInt64.
void prepare(std::size_t pos, std::vector<Poco::UInt64>& val);
/// Prepares an UInt64 vector.
void prepare(std::size_t pos, std::deque<Poco::UInt64>& val);
/// Prepares an UInt64 deque.
void prepare(std::size_t pos, std::list<Poco::UInt64>& val);
/// Prepares an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
void prepare(std::size_t pos, long& val);
/// Prepares a long.
void prepare(std::size_t pos, std::vector<long>& val);
/// Prepares a long vector.
void prepare(std::size_t pos, std::deque<long>& val);
/// Prepares a long deque.
void prepare(std::size_t pos, std::list<long>& val);
/// Prepares a long list.
#endif
void prepare(std::size_t pos, bool& val);
@ -189,66 +242,132 @@ public:
void prepare(std::size_t pos, std::vector<bool>& val);
/// Prepares a boolean vector.
void prepare(std::size_t pos, std::deque<bool>& val);
/// Prepares a boolean deque.
void prepare(std::size_t pos, std::list<bool>& val);
/// Prepares a boolean list.
void prepare(std::size_t pos, float& val);
/// Prepares a float.
void prepare(std::size_t pos, std::vector<float>& val);
/// Prepares a float vector.
void prepare(std::size_t pos, std::deque<float>& val);
/// Prepares a float deque.
void prepare(std::size_t pos, std::list<float>& val);
/// Prepares a float list.
void prepare(std::size_t pos, double& val);
/// Prepares a double.
void prepare(std::size_t pos, std::vector<double>& val);
/// Prepares a double vector.
void prepare(std::size_t pos, std::deque<double>& val);
/// Prepares a double deque.
void prepare(std::size_t pos, std::list<double>& val);
/// Prepares a double list.
void prepare(std::size_t pos, char& val);
/// Prepares a single character.
void prepare(std::size_t pos, std::vector<char>& val);
/// Prepares a single character vector.
void prepare(std::size_t pos, std::deque<char>& val);
/// Prepares a single character deque.
void prepare(std::size_t pos, std::list<char>& val);
/// Prepares a single character list.
void prepare(std::size_t pos, const std::string& val);
/// Prepares a string.
void prepare(std::size_t pos, const std::vector<std::string>& val);
/// Prepares a string vector.
void prepare(std::size_t pos, const std::deque<std::string>& val);
/// Prepares a string deque.
void prepare(std::size_t pos, const std::list<std::string>& val);
/// Prepares a string list.
void prepare(std::size_t pos, const Poco::Data::BLOB& val);
/// Prepares a BLOB.
void prepare(std::size_t pos, const std::vector<Poco::Data::BLOB>& val);
/// Prepares a BLOB vector.
void prepare(std::size_t pos, const std::deque<Poco::Data::BLOB>& val);
/// Prepares a BLOB deque.
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::Date& val);
/// Prepares a Date.
void prepare(std::size_t pos, const std::vector<Poco::Data::Date>& val);
/// Prepares a Date vector.
void prepare(std::size_t pos, const std::deque<Poco::Data::Date>& val);
/// Prepares a Date deque.
void prepare(std::size_t pos, const std::list<Poco::Data::Date>& val);
/// Prepares a Date list.
void prepare(std::size_t pos, const Poco::Data::Time& val);
/// Prepares a Time.
void prepare(std::size_t pos, const std::vector<Poco::Data::Time>& val);
/// Prepares a Time vector.
void prepare(std::size_t pos, const std::deque<Poco::Data::Time>& val);
/// Prepares a Time deque.
void prepare(std::size_t pos, const std::list<Poco::Data::Time>& val);
/// Prepares a Time list.
void prepare(std::size_t pos, const Poco::DateTime& val);
/// Prepares a DateTime.
void prepare(std::size_t pos, const std::vector<Poco::DateTime>& val);
/// Prepares a DateTime vector.
void prepare(std::size_t pos, const std::deque<Poco::DateTime>& val);
/// Prepares a DateTime deque.
void prepare(std::size_t pos, const std::list<Poco::DateTime>& val);
/// Prepares a DateTime list.
void prepare(std::size_t pos, const Poco::Any& val);
/// Prepares an Any.
void prepare(std::size_t pos, const std::vector<Poco::Any>& val);
/// Prepares an Any vector.
void prepare(std::size_t pos, const std::deque<Poco::Any>& val);
/// Prepares an Any deque.
void prepare(std::size_t pos, const std::list<Poco::Any>& val);
/// Prepares an Any list.
void prepare(std::size_t pos, const Poco::DynamicAny& val);
/// Prepares a DynamicAny.
void prepare(std::size_t pos, const std::vector<Poco::DynamicAny>& val);
/// Prepares a DynamicAny vector.
void prepare(std::size_t pos, const std::deque<Poco::DynamicAny>& val);
/// Prepares a DynamicAny deque.
void prepare(std::size_t pos, const std::list<Poco::DynamicAny>& val);
/// Prepares a DynamicAny list.
std::size_t columns() const;
/// Returns the number of columns.
/// Resizes the internal storage iff the size is zero.
@ -292,8 +411,8 @@ private:
Preparation();
Preparation& operator = (const Preparation&);
template <typename T>
void prepareImpl(std::size_t pos, const std::vector<T>* pVal = 0)
template <typename C>
void prepareImpl(std::size_t pos, const C* pVal = 0)
/// Utility function to prepare Any and DynamicAny.
{
ODBCColumn col(_rStmt, pos);
@ -350,7 +469,7 @@ private:
case MetaColumn::FDT_BOOL:
if (pVal)
return prepareVariableLen<bool>(pos, SQL_C_BIT, pVal->size(), DT_BOOL);
return prepareBoolArray(pos, SQL_C_BIT, pVal->size());
else
return prepareFixedSize<bool>(pos, SQL_C_BIT);
@ -368,13 +487,13 @@ private:
case MetaColumn::FDT_STRING:
if (pVal)
return prepareVariableLenArray(pos, SQL_C_CHAR, maxDataSize(pos), pVal->size(), DT_CHAR_ARRAY);
return prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), pVal->size());
else
return prepareVariableLen<char>(pos, SQL_C_CHAR, maxDataSize(pos), DT_CHAR);
case MetaColumn::FDT_BLOB:
if (pVal)
return prepareVariableLenArray(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size(), DT_CHAR_ARRAY);
return prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
else
return prepareVariableLen<char>(pos, SQL_C_BINARY, maxDataSize(pos), DT_CHAR);
@ -436,13 +555,14 @@ private:
poco_assert (pos < _values.size());
poco_assert (length);
_values[pos] = Poco::Any(std::vector<T>(length));
_values[pos] = Poco::Any(std::vector<T>());
_lengths[pos] = 0;
poco_assert (0 == _lenLengths[pos].size());
_lenLengths[pos].resize(length);
std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]);
cache.resize(length);
if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1,
valueType,
@ -456,13 +576,12 @@ private:
template <typename T>
void prepareVariableLen(std::size_t pos, SQLSMALLINT valueType, std::size_t size, DataType dt)
/// Utility function for preparation of variable length columns and bool vectors.
/// Utility function for preparation of variable length columns.
{
poco_assert (DE_BOUND == _dataExtraction);
poco_assert (pos < _values.size());
T* pCache = new T[size];
poco_assert_dbg (pCache);
std::memset(pCache, 0, size);
_values[pos] = Any(pCache);
@ -481,9 +600,11 @@ private:
}
void prepareVariableLenArray(std::size_t pos, SQLSMALLINT valueType, std::size_t size, std::size_t length, DataType dt);
/// Utility function for preparation of variable length character and BLOB columns.
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.
void prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, std::size_t length);
/// Utility function for preparation of bulk bool columns.
void freeMemory() const;
/// Utility function. Releases memory allocated for variable length columns.
@ -520,6 +641,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int8>& val)
}
inline void Preparation::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)
{
prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::UInt8&)
{
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT);
@ -532,6 +665,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt8>& val)
}
inline void Preparation::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)
{
prepareFixedSize<Poco::UInt8>(pos, SQL_C_UTINYINT, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::Int16&)
{
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT);
@ -544,6 +689,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int16>& val)
}
inline void Preparation::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)
{
prepareFixedSize<Poco::Int16>(pos, SQL_C_SSHORT, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::UInt16&)
{
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT);
@ -556,6 +713,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt16>& val
}
inline void Preparation::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)
{
prepareFixedSize<Poco::UInt16>(pos, SQL_C_USHORT, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::Int32&)
{
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG);
@ -568,6 +737,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int32>& val)
}
inline void Preparation::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)
{
prepareFixedSize<Poco::Int32>(pos, SQL_C_SLONG, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::UInt32&)
{
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG);
@ -580,6 +761,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt32>& val
}
inline void Preparation::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)
{
prepareFixedSize<Poco::UInt32>(pos, SQL_C_ULONG, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::Int64&)
{
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT);
@ -592,6 +785,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::Int64>& val)
}
inline void Preparation::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)
{
prepareFixedSize<Poco::Int64>(pos, SQL_C_SBIGINT, val.size());
}
inline void Preparation::prepare(std::size_t pos, Poco::UInt64&)
{
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT);
@ -604,6 +809,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<Poco::UInt64>& val
}
inline void Preparation::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)
{
prepareFixedSize<Poco::UInt64>(pos, SQL_C_UBIGINT, val.size());
}
#ifndef POCO_LONG_IS_64_BIT
inline void Preparation::prepare(std::size_t pos, long&)
{
@ -615,6 +832,18 @@ inline void Preparation::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)
{
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
}
inline void Preparation::prepare(std::size_t pos, std::list<long>& val)
{
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
}
#endif
@ -626,7 +855,19 @@ inline void Preparation::prepare(std::size_t pos, bool&)
inline void Preparation::prepare(std::size_t pos, std::vector<bool>& val)
{
prepareVariableLen<bool>(pos, SQL_C_BIT, val.size(), DT_BOOL);
prepareBoolArray(pos, SQL_C_BIT, val.size());
}
inline void Preparation::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)
{
prepareBoolArray(pos, SQL_C_BIT, val.size());
}
@ -642,6 +883,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<float>& val)
}
inline void Preparation::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)
{
prepareFixedSize<float>(pos, SQL_C_FLOAT, val.size());
}
inline void Preparation::prepare(std::size_t pos, double&)
{
prepareFixedSize<double>(pos, SQL_C_DOUBLE);
@ -654,6 +907,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<double>& val)
}
inline void Preparation::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)
{
prepareFixedSize<double>(pos, SQL_C_DOUBLE, val.size());
}
inline void Preparation::prepare(std::size_t pos, char&)
{
prepareFixedSize<char>(pos, SQL_C_STINYINT);
@ -666,6 +931,18 @@ inline void Preparation::prepare(std::size_t pos, std::vector<char>& val)
}
inline void Preparation::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)
{
prepareFixedSize<char>(pos, SQL_C_STINYINT, val.size());
}
inline void Preparation::prepare(std::size_t pos, const std::string&)
{
prepareVariableLen<char>(pos, SQL_C_CHAR, maxDataSize(pos), DT_CHAR);
@ -674,7 +951,19 @@ inline void Preparation::prepare(std::size_t pos, const std::string&)
inline void Preparation::prepare(std::size_t pos, const std::vector<std::string>& val)
{
prepareVariableLenArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size(), DT_CHAR_ARRAY);
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
}
inline void Preparation::prepare(std::size_t pos, const std::deque<std::string>& val)
{
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
}
inline void Preparation::prepare(std::size_t pos, const std::list<std::string>& val)
{
prepareCharArray(pos, SQL_C_CHAR, maxDataSize(pos), val.size());
}
@ -686,7 +975,19 @@ inline void Preparation::prepare(std::size_t pos, const Poco::Data::BLOB&)
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::BLOB>& val)
{
prepareVariableLenArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size(), DT_CHAR_ARRAY);
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
}
inline void Preparation::prepare(std::size_t pos, const std::deque<Poco::Data::BLOB>& val)
{
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
}
inline void Preparation::prepare(std::size_t pos, const std::list<Poco::Data::BLOB>& val)
{
prepareCharArray(pos, SQL_C_BINARY, maxDataSize(pos), val.size());
}
@ -702,6 +1003,18 @@ inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::
}
inline void Preparation::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)
{
prepareFixedSize<SQL_DATE_STRUCT>(pos, SQL_C_TYPE_DATE, val.size());
}
inline void Preparation::prepare(std::size_t pos, const Poco::Data::Time&)
{
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME);
@ -714,6 +1027,18 @@ inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Data::
}
inline void Preparation::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)
{
prepareFixedSize<SQL_TIME_STRUCT>(pos, SQL_C_TYPE_TIME, val.size());
}
inline void Preparation::prepare(std::size_t pos, const Poco::DateTime&)
{
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP);
@ -726,27 +1051,63 @@ inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::DateTi
}
inline void Preparation::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)
{
prepareFixedSize<SQL_TIMESTAMP_STRUCT>(pos, SQL_C_TYPE_TIMESTAMP, val.size());
}
inline void Preparation::prepare(std::size_t pos, const Poco::Any& val)
{
prepareImpl<Poco::Any>(pos);
prepareImpl<std::vector<Poco::Any> >(pos);
}
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::Any>& val)
{
prepareImpl<Poco::Any>(pos, &val);
prepareImpl<std::vector<Poco::Any> >(pos, &val);
}
inline void Preparation::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)
{
prepareImpl<std::list<Poco::Any> >(pos, &val);
}
inline void Preparation::prepare(std::size_t pos, const Poco::DynamicAny& val)
{
prepareImpl<Poco::DynamicAny>(pos);
prepareImpl<std::vector<Poco::DynamicAny> >(pos);
}
inline void Preparation::prepare(std::size_t pos, const std::vector<Poco::DynamicAny>& val)
{
prepareImpl<Poco::DynamicAny>(pos, &val);
prepareImpl<std::vector<Poco::DynamicAny> >(pos, &val);
}
inline void Preparation::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)
{
prepareImpl<std::list<Poco::DynamicAny> >(pos, &val);
}

View File

@ -97,38 +97,92 @@ public:
static void dateSync(Date& dt, const SQL_DATE_STRUCT& ts);
/// Transfers data from ODBC SQL_DATE_STRUCT to Poco::DateTime.
static void dateSync(std::vector<Date>& d, const std::vector<SQL_DATE_STRUCT>& ds);
/// Transfers data from ODBC SQL_DATE_STRUCT vector to Poco::DateTime vector.
template <typename T, typename F>
static void dateSync(T& d, const F& ds)
/// Transfers data from ODBC SQL_DATE_STRUCT container to Poco::DateTime container.
{
std::size_t size = ds.size();
if (d.size() != size) d.resize(size);
typename T::iterator dIt = d.begin();
typename F::const_iterator it = ds.begin();
typename F::const_iterator end = ds.end();
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
}
static void timeSync(Time& dt, const SQL_TIME_STRUCT& ts);
/// Transfers data from ODBC SQL_TIME_STRUCT to Poco::DateTime.
static void timeSync(std::vector<Time>& t, const std::vector<SQL_TIME_STRUCT>& ts);
/// Transfers data from ODBC SQL_TIME_STRUCT vector to Poco::DateTime vector.
template <typename T, typename F>
static void timeSync(T& t, const F& ts)
/// Transfers data from ODBC SQL_TIME_STRUCT container to Poco::DateTime container.
{
std::size_t size = ts.size();
if (t.size() != size) t.resize(size);
typename T::iterator dIt = t.begin();
typename F::const_iterator it = ts.begin();
typename F::const_iterator end = ts.end();
for (; it != end; ++it, ++dIt) timeSync(*dIt, *it);
}
static void dateTimeSync(Poco::DateTime& dt, const SQL_TIMESTAMP_STRUCT& ts);
/// Transfers data from ODBC SQL_TIMESTAMP_STRUCT to Poco::DateTime.
static void dateTimeSync(std::vector<Poco::DateTime>& dt, const std::vector<SQL_TIMESTAMP_STRUCT>& ts);
/// Transfers data from ODBC SQL_TIMESTAMP_STRUCT vector to Poco::DateTime vector.
template <typename T, typename F>
static void dateTimeSync(T& dt, const F& ts)
/// Transfers data from ODBC SQL_TIMESTAMP_STRUCT container to Poco::DateTime container.
{
std::size_t size = ts.size();
if (dt.size() != size) dt.resize(size);
typename T::iterator dIt = dt.begin();
typename F::const_iterator it = ts.begin();
typename F::const_iterator end = ts.end();
for (; it != end; ++it, ++dIt) dateTimeSync(*dIt, *it);
}
static void dateSync(SQL_DATE_STRUCT& ts, const Date& dt);
/// Transfers data from Poco::Data::Date to ODBC SQL_DATE_STRUCT.
static void dateSync(std::vector<SQL_DATE_STRUCT>& ds, const std::vector<Date>& d);
/// Transfers data from Poco::Data::Date vector to ODBC SQL_DATE_STRUCT vector.
template <typename C>
static void dateSync(std::vector<SQL_DATE_STRUCT>& ds, const C& d)
/// Transfers data from Poco::Data::Date vector to ODBC SQL_DATE_STRUCT container.
{
std::size_t size = d.size();
if (ds.size() != size) ds.resize(size);
std::vector<SQL_DATE_STRUCT>::iterator dIt = ds.begin();
typename C::const_iterator it = d.begin();
typename C::const_iterator end = d.end();
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
}
static void timeSync(SQL_TIME_STRUCT& ts, const Time& dt);
/// Transfers data from Poco::Data::Time to ODBC SQL_TIME_STRUCT.
static void timeSync(std::vector<SQL_TIME_STRUCT>& ts, const std::vector<Time>& t);
/// Transfers data from Poco::Data::Time vector to ODBC SQL_TIME_STRUCT vector.
template <typename C>
static void timeSync(std::vector<SQL_TIME_STRUCT>& ts, const C& t)
/// Transfers data from Poco::Data::Time container to ODBC SQL_TIME_STRUCT vector.
{
std::size_t size = t.size();
if (ts.size() != size) ts.resize(size);
std::vector<SQL_TIME_STRUCT>::iterator tIt = ts.begin();
typename C::const_iterator it = t.begin();
typename C::const_iterator end = t.end();
for (; it != end; ++it, ++tIt) timeSync(*tIt, *it);
}
static void dateTimeSync(SQL_TIMESTAMP_STRUCT& ts, const Poco::DateTime& dt);
/// Transfers data from Poco::DateTime to ODBC SQL_TIMESTAMP_STRUCT.
static void dateTimeSync(std::vector<SQL_TIMESTAMP_STRUCT>& ts, const std::vector<Poco::DateTime>& dt);
template <typename C>
static void dateTimeSync(std::vector<SQL_TIMESTAMP_STRUCT>& ts, const C& dt)
/// Transfers data from Poco::DateTime to ODBC SQL_TIMESTAMP_STRUCT.
{
std::size_t size = dt.size();
if (ts.size() != size) ts.resize(size);
std::vector<SQL_TIMESTAMP_STRUCT>::iterator tIt = ts.begin();
typename C::const_iterator it = dt.begin();
typename C::const_iterator end = dt.end();
for (; it != end; ++it, ++tIt) dateTimeSync(*tIt, *it);
}
private:
static const TypeInfo _dataTypes;

View File

@ -158,63 +158,6 @@ void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("String vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = 0;
getColumnOrParameterSize(pos, size);
poco_assert (size > 0);
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), SQL_NTS);
}
if (_charPtrs.size() <= pos)
_charPtrs.resize(pos + 1, 0);
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char));
std::size_t strSize;
std::size_t offset = 0;
std::vector<std::string>::const_iterator it = val.begin();
std::vector<std::string>::const_iterator end = val.end();
for (; it != end; ++it)
{
strSize = it->size();
if (strSize > size)
throw LengthExceededException("SQLBindParameter(std::vector<std::string>)");
std::memcpy(_charPtrs[pos] + offset, it->c_str(), strSize);
offset += size;
}
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_CHAR,
SQL_LONGVARCHAR,
(SQLUINTEGER) size - 1,
0,
_charPtrs[pos],
(SQLINTEGER) size,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter(std::vector<std::string>)");
}
}
void Binder::bind(std::size_t pos, const BLOB& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
@ -249,78 +192,6 @@ void Binder::bind(std::size_t pos, const BLOB& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("BLOB vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = 0;
getColumnOrParameterSize(pos, size);
poco_assert (size > 0);
if (size == _maxFieldSize)
{
std::size_t maxSize = 0;
std::vector<BLOB>::const_iterator it = val.begin();
std::vector<BLOB>::const_iterator end = val.end();
for (; it != end; ++it)
{
std::size_t sz = it->size();
if (sz < _maxFieldSize && sz > maxSize)
maxSize = sz;
}
if (maxSize) size = maxSize;
}
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), SQL_NTS);
}
if (_charPtrs.size() <= pos)
_charPtrs.resize(pos + 1, 0);
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char));
poco_check_ptr (_charPtrs[pos]);
std::size_t blobSize;
std::size_t offset = 0;
std::vector<BLOB>::const_iterator it = val.begin();
std::vector<BLOB>::const_iterator end = val.end();
for (; it != end; ++it)
{
blobSize = it->size();
if (blobSize > size)
throw LengthExceededException("SQLBindParameter(std::vector<BLOB>)");
std::memcpy(_charPtrs[pos] + offset, it->rawContent(), blobSize);
offset += size;
}
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_BINARY,
SQL_LONGVARBINARY,
(SQLUINTEGER) size,
0,
_charPtrs[pos],
(SQLINTEGER) size,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)");
}
}
void Binder::bind(std::size_t pos, const Date& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
@ -354,50 +225,6 @@ void Binder::bind(std::size_t pos, const Date& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<Date>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("Date vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), size);
}
if (_dateVec.size() <= pos) _dateVec.resize(pos + 1);
Utility::dateSync(_dateVec[pos], val);
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_DATE,
SQL_DATE,
colSize,
decDigits,
(SQLPOINTER) &_dateVec[pos][0],
0,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter(Date[])");
}
}
void Binder::bind(std::size_t pos, const Time& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIME_STRUCT);
@ -431,50 +258,6 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<Time>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("Time vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIME_STRUCT);
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), size);
}
if (_timeVec.size() <= pos) _timeVec.resize(pos + 1);
Utility::timeSync(_timeVec[pos], val);
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TIME,
SQL_TIME,
colSize,
decDigits,
(SQLPOINTER) &_timeVec[pos][0],
0,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter(Time[])");
}
}
void Binder::bind(std::size_t pos, const Poco::DateTime& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIMESTAMP_STRUCT);
@ -508,50 +291,6 @@ void Binder::bind(std::size_t pos, const Poco::DateTime& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("DateTime vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIMESTAMP_STRUCT);
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), size);
}
if (_dateTimeVec.size() <= pos) _dateTimeVec.resize(pos + 1);
Utility::dateTimeSync(_dateTimeVec[pos], val);
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TIMESTAMP,
SQL_TIMESTAMP,
colSize,
decDigits,
(SQLPOINTER) &_dateTimeVec[pos][0],
0,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter(Time[])");
}
}
void Binder::bind(std::size_t pos, const NullData& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
@ -584,90 +323,6 @@ void Binder::bind(std::size_t pos, const NullData& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::vector<NullData>& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("DateTime vector parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
if (0 == val.size())
throw InvalidArgumentException("Empty vector not allowed.");
setParamSetSize(pos, val.size());
SQLINTEGER size = SQL_NULL_DATA;
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(val.size(), size);
}
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_STINYINT,
Utility::sqlDataType(SQL_C_STINYINT),
colSize,
decDigits,
0,
0,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter()");
}
}
void Binder::bindImplVecBool(std::size_t pos, const std::vector<bool>& val, SQLSMALLINT cDataType, Direction dir)
{
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("std::vector can only be bound immediately.");
std::size_t length = val.size();
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, cDataType, colSize, decDigits);
setParamSetSize(pos, val.size());
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1);
_vecLengthIndicator[pos].resize(length, sizeof(bool));
}
if (_boolPtrs.size() <= pos)
_boolPtrs.resize(pos + 1);
_boolPtrs[pos] = new bool[val.size()];
std::vector<bool>::const_iterator it = val.begin();
std::vector<bool>::const_iterator end = val.end();
for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it;
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
cDataType,
Utility::sqlDataType(cDataType),
colSize,
decDigits,
(SQLPOINTER) &_boolPtrs[pos][0],
0,
&_vecLengthIndicator[pos][0])))
{
throw StatementException(_rStmt, "SQLBindParameter()");
}
}
std::size_t Binder::parameterSize(SQLPOINTER pAddr) const
{
ParamMap::const_iterator it = _inParams.find(pAddr);
@ -831,13 +486,13 @@ void Binder::getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size)
}
if (colSize > 0 && paramSize > 0)
size = colSize < paramSize ? colSize : paramSize;
size = colSize < paramSize ? static_cast<SQLINTEGER>(colSize) : static_cast<SQLINTEGER>(paramSize);
else if (colSize > 0)
size = colSize;
size = static_cast<SQLINTEGER>(colSize);
else if (paramSize > 0)
size = paramSize;
size = static_cast<SQLINTEGER>(paramSize);
if (size > _maxFieldSize) size = _maxFieldSize;
if (size > _maxFieldSize) size = static_cast<SQLINTEGER>(_maxFieldSize);
}

View File

@ -84,7 +84,7 @@ bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
template<>
bool Extractor::extractBoundImpl<std::vector<std::string> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<std::string> >(std::size_t pos,
std::vector<std::string>& values)
{
char** pc = AnyCast<char*>(&_rPreparation[pos]);
@ -100,6 +100,40 @@ bool Extractor::extractBoundImpl<std::vector<std::string> >(std::size_t pos,
}
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)
{
@ -115,7 +149,7 @@ bool Extractor::extractBoundImpl<Poco::Data::BLOB>(std::size_t pos, Poco::Data::
template<>
bool Extractor::extractBoundImpl<std::vector<Poco::Data::BLOB> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::BLOB> >(std::size_t pos,
std::vector<Poco::Data::BLOB>& values)
{
char** pc = AnyCast<char*>(&_rPreparation[pos]);
@ -131,6 +165,40 @@ bool Extractor::extractBoundImpl<std::vector<Poco::Data::BLOB> >(std::size_t pos
}
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 = columnSize(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 = columnSize(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)
{
@ -142,7 +210,7 @@ bool Extractor::extractBoundImpl<Poco::Data::Date>(std::size_t pos, Poco::Data::
template<>
bool Extractor::extractBoundImpl<std::vector<Poco::Data::Date> >(std::size_t pos,
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]);
@ -151,6 +219,26 @@ bool Extractor::extractBoundImpl<std::vector<Poco::Data::Date> >(std::size_t pos
}
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]);
Utility::dateSync(val, ds);
return true;
}
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]);
Utility::dateSync(val, ds);
return true;
}
template<>
bool Extractor::extractBoundImpl<Poco::Data::Time>(std::size_t pos, Poco::Data::Time& val)
{
@ -166,7 +254,7 @@ bool Extractor::extractBoundImpl<Poco::Data::Time>(std::size_t pos, Poco::Data::
template<>
bool Extractor::extractBoundImpl<std::vector<Poco::Data::Time> >(std::size_t pos,
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]);
@ -175,6 +263,26 @@ bool Extractor::extractBoundImpl<std::vector<Poco::Data::Time> >(std::size_t pos
}
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]);
Utility::timeSync(val, ds);
return true;
}
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]);
Utility::timeSync(val, ds);
return true;
}
template<>
bool Extractor::extractBoundImpl<Poco::DateTime>(std::size_t pos, Poco::DateTime& val)
{
@ -190,7 +298,7 @@ bool Extractor::extractBoundImpl<Poco::DateTime>(std::size_t pos, Poco::DateTime
template<>
bool Extractor::extractBoundImpl<std::vector<Poco::DateTime> >(std::size_t pos,
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]);
@ -200,13 +308,54 @@ bool Extractor::extractBoundImpl<std::vector<Poco::DateTime> >(std::size_t pos,
template<>
bool Extractor::extractBoundImpl<std::vector<bool> >(std::size_t pos, std::vector<bool>& val)
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]);
Utility::dateTimeSync(val, ds);
return true;
}
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]);
Utility::dateTimeSync(val, ds);
return true;
}
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]);
for (int i = 0; i < length; ++i)
val.push_back(p[i]);
bool** p = AnyCast<bool*>(&_rPreparation[pos]);
val.assign(*p, *p + length);
return true;
}
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]);
val.assign(*p, *p + length);
return true;
}
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]);
val.assign(*p, *p + length);
return true;
}
@ -413,11 +562,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
{
if (Preparation::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::Int32>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -433,11 +598,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
{
if (Preparation::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::Int64>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -454,11 +635,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<long>& val)
{
if (Preparation::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<long>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
#endif
@ -475,11 +672,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<double>& val)
{
if (Preparation::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<double>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -495,11 +708,27 @@ 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)
return extractBoundImpl(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
{
if (Preparation::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<std::string>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -515,11 +744,27 @@ 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)
return extractBoundImpl(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
{
if (Preparation::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::BLOB>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -535,11 +780,27 @@ 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)
return extractBoundImpl(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
{
if (Preparation::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::Date>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -555,11 +816,27 @@ 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)
return extractBoundImpl(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
{
if (Preparation::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::Time>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -575,11 +852,27 @@ 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)
return extractBoundImpl(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
{
if (Preparation::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::DateTime>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -595,11 +888,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
{
if (Preparation::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::Int8>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -615,9 +924,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
{
if (Preparation::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::UInt8>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -633,11 +960,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
{
if (Preparation::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::Int16>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -653,11 +996,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
{
if (Preparation::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::UInt16>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -673,11 +1032,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
{
if (Preparation::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::UInt32>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -693,11 +1068,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
{
if (Preparation::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::UInt64>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -713,11 +1104,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
{
if (Preparation::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<bool>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -733,11 +1140,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<float>& val)
{
if (Preparation::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<float>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -753,11 +1176,27 @@ 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)
return extractBoundImplVec(pos, val);
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<char>& val)
{
if (Preparation::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<char>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -772,9 +1211,25 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Any>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
@ -789,9 +1244,25 @@ bool Extractor::extract(std::size_t pos, std::vector<Poco::DynamicAny>& val)
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct vector extraction only allowed for bound mode.");
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::DynamicAny>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::list<Poco::DynamicAny>& val)
{
if (Preparation::DE_BOUND == _dataExtraction)
return extractBoundImpl(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}

View File

@ -95,6 +95,10 @@ void Preparation::freeMemory() const
std::free(AnyCast<char>(&_values[it->first]));
break;
case DT_BOOL_ARRAY:
std::free(AnyCast<bool>(&_values[it->first]));
break;
case DT_DATE:
deleteCachedArray<SQL_DATE_STRUCT>(it->first);
break;
@ -153,7 +157,7 @@ std::size_t Preparation::maxDataSize(std::size_t pos) const
}
void Preparation::prepareVariableLenArray(std::size_t pos, SQLSMALLINT valueType, std::size_t size, std::size_t length, DataType dt)
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());
@ -165,7 +169,7 @@ void Preparation::prepareVariableLenArray(std::size_t pos, SQLSMALLINT valueType
_values[pos] = Any(pArray);
_lengths[pos] = 0;
_lenLengths[pos].resize(length);
_varLengthArrays.insert(IndexMap::value_type(pos, dt));
_varLengthArrays.insert(IndexMap::value_type(pos, DT_CHAR_ARRAY));
if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1,
@ -179,4 +183,30 @@ void Preparation::prepareVariableLenArray(std::size_t pos, SQLSMALLINT valueType
}
void Preparation::prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, 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());
bool* pArray = (bool*) std::calloc(length, sizeof(bool));
_values[pos] = Any(pArray);
_lengths[pos] = 0;
_lenLengths[pos].resize(length);
_varLengthArrays.insert(IndexMap::value_type(pos, DT_BOOL_ARRAY));
if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1,
valueType,
(SQLPOINTER) pArray,
(SQLINTEGER) sizeof(bool),
&_lenLengths[pos][0])))
{
throw StatementException(_rStmt, "SQLBindCol()");
}
}
} } } // namespace Poco::Data::ODBC

View File

@ -138,17 +138,6 @@ void Utility::dateTimeSync(Poco::DateTime& dt, const SQL_TIMESTAMP_STRUCT& ts)
}
void Utility::dateTimeSync(std::vector<Poco::DateTime>& dt, const std::vector<SQL_TIMESTAMP_STRUCT>& ts)
{
std::size_t size = ts.size();
if (dt.size() != size) dt.resize(size);
std::vector<Poco::DateTime>::iterator dIt = dt.begin();
std::vector<SQL_TIMESTAMP_STRUCT>::const_iterator it = ts.begin();
std::vector<SQL_TIMESTAMP_STRUCT>::const_iterator end = ts.end();
for (; it != end; ++it, ++dIt) dateTimeSync(*dIt, *it);
}
void Utility::dateSync(SQL_DATE_STRUCT& ds, const Date& d)
{
ds.year = d.year();
@ -157,17 +146,6 @@ void Utility::dateSync(SQL_DATE_STRUCT& ds, const Date& d)
}
void Utility::dateSync(std::vector<SQL_DATE_STRUCT>& ds, const std::vector<Date>& d)
{
std::size_t size = d.size();
if (ds.size() != size) ds.resize(size);
std::vector<SQL_DATE_STRUCT>::iterator dIt = ds.begin();
std::vector<Date>::const_iterator it = d.begin();
std::vector<Date>::const_iterator end = d.end();
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
}
void Utility::timeSync(SQL_TIME_STRUCT& ts, const Time& t)
{
ts.hour = t.hour();
@ -176,17 +154,6 @@ void Utility::timeSync(SQL_TIME_STRUCT& ts, const Time& t)
}
void Utility::timeSync(std::vector<SQL_TIME_STRUCT>& ts, const std::vector<Time>& t)
{
std::size_t size = t.size();
if (ts.size() != size) ts.resize(size);
std::vector<SQL_TIME_STRUCT>::iterator tIt = ts.begin();
std::vector<Time>::const_iterator it = t.begin();
std::vector<Time>::const_iterator end = t.end();
for (; it != end; ++it, ++tIt) timeSync(*tIt, *it);
}
void Utility::dateTimeSync(SQL_TIMESTAMP_STRUCT& ts, const Poco::DateTime& dt)
{
ts.year = dt.year();
@ -201,37 +168,4 @@ void Utility::dateTimeSync(SQL_TIMESTAMP_STRUCT& ts, const Poco::DateTime& dt)
}
void Utility::dateTimeSync(std::vector<SQL_TIMESTAMP_STRUCT>& ts, const std::vector<Poco::DateTime>& dt)
{
std::size_t size = dt.size();
if (ts.size() != size) ts.resize(size);
std::vector<SQL_TIMESTAMP_STRUCT>::iterator tIt = ts.begin();
std::vector<Poco::DateTime>::const_iterator it = dt.begin();
std::vector<Poco::DateTime>::const_iterator end = dt.end();
for (; it != end; ++it, ++tIt) dateTimeSync(*tIt, *it);
}
void Utility::dateSync(std::vector<Date>& d, const std::vector<SQL_DATE_STRUCT>& ds)
{
std::size_t size = ds.size();
if (d.size() != size) d.resize(size);
std::vector<Date>::iterator dIt = d.begin();
std::vector<SQL_DATE_STRUCT>::const_iterator it = ds.begin();
std::vector<SQL_DATE_STRUCT>::const_iterator end = ds.end();
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
}
void Utility::timeSync(std::vector<Time>& t, const std::vector<SQL_TIME_STRUCT>& ts)
{
std::size_t size = ts.size();
if (t.size() != size) t.resize(size);
std::vector<Time>::iterator dIt = t.begin();
std::vector<SQL_TIME_STRUCT>::const_iterator it = ts.begin();
std::vector<SQL_TIME_STRUCT>::const_iterator end = ts.end();
for (; it != end; ++it, ++dIt) timeSync(*dIt, *it);
}
} } } // namespace Poco::Data::ODBC

View File

@ -165,6 +165,19 @@ void ODBCDB2Test::testBLOB()
}
void ODBCDB2Test::testBulk()
{
if (!_pSession) fail ("Test not available.");
_pSession->setFeature("autoBind", true);
_pSession->setFeature("autoExtract", true);
recreateMiscTable();
_pExecutor->doBulkStringIntFloat(100);
recreateMiscTable();
_pExecutor->doBulkPerformance(1000);
}
void ODBCDB2Test::testStoredProcedure()
{
if (!_pSession) fail ("Test not available.");
@ -539,6 +552,23 @@ void ODBCDB2Test::recreateNullsTable(const std::string& notNull)
}
void ODBCDB2Test::recreateMiscTable()
{
dropObject("TABLE", "MiscTest");
try
{
// DB2 fails with BLOB
session() << "CREATE TABLE MiscTest "
"(First VARCHAR(30),"
//"Second BLOB,"
"Third INTEGER,"
"Fourth FLOAT,"
"Fifth TIMESTAMP)", now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
}
CppUnit::Test* ODBCDB2Test::suite()
{
if (_pSession = init(_driver, _dsn, _uid, _pwd, _connectString))

View File

@ -55,7 +55,8 @@ public:
void testBareboneODBC();
void testBLOB();
void testBulk();
void testStoredProcedure();
void testStoredProcedureAny();
void testStoredProcedureDynamicAny();
@ -77,6 +78,7 @@ private:
void recreateVectorsTable();
void recreateAnysTable();
void recreateNullsTable(const std::string& notNull = "");
void recreateMiscTable();
static ODBCTest::SessionPtr _pSession;
static ODBCTest::ExecPtr _pExecutor;

View File

@ -413,8 +413,31 @@ void ODBCTest::testBulk()
_pSession->setFeature("autoBind", true);
_pSession->setFeature("autoExtract", true);
recreateMiscTable();
_pExecutor->doBulk(100);
_pExecutor->doBulk<std::vector<int>,
std::vector<std::string>,
std::vector<BLOB>,
std::vector<double>,
std::vector<DateTime>,
std::vector<bool> >(100);
recreateMiscTable();
_pExecutor->doBulk<std::deque<int>,
std::deque<std::string>,
std::deque<BLOB>,
std::deque<double>,
std::deque<DateTime>,
std::deque<bool> >(100);
recreateMiscTable();
_pExecutor->doBulk<std::list<int>,
std::list<std::string>,
std::list<BLOB>,
std::list<double>,
std::list<DateTime>,
std::list<bool> >(100);
recreateMiscTable();
_pExecutor->doBulkPerformance(1000);
}

View File

@ -1465,145 +1465,6 @@ void SQLExecutor::prepare()
}
void SQLExecutor::doBulk(Poco::UInt32 size)
{
std::string funct = "doBulk()";
std::vector<int> ints(size, 1);
std::vector<std::string> strings(size);
std::vector<BLOB> blobs(size);
std::vector<double> floats(size);
std::vector<DateTime> dateTimes(size);
std::vector<bool> bools;
for (int i = 0; i < size; ++i)
{
ints[i] = i;
strings[i] = "xyz" + NumberFormatter::format(i);
blobs[i] = "abc" + NumberFormatter::format(i);
floats[i] = i + .5;
bools.push_back(0 == i % 2);
}
try
{
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?,?)",
use(strings),
use(blobs),
use(ints),
use(floats),
use(dateTimes),
use(bools), now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { session() << "DELETE FROM MiscTest", now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try
{
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?,?)",
use(strings, bulk),
use(blobs, bulk),
use(ints, bulk),
use(floats, bulk),
use(dateTimes, bulk),
use(bools, bulk), now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
ints.clear();
strings.clear();
blobs.clear();
floats.clear();
dateTimes.clear();
bools.clear();
try
{
session() << "SELECT * FROM MiscTest ORDER BY Third",
into(strings),
into(blobs),
into(ints),
into(floats),
into(dateTimes),
into(bools),
now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
std::string number = NumberFormatter::format(size - 1);
assert (size == ints.size());
assert (0 == ints[0]);
assert (ints.size() - 1 == ints[ints.size() - 1]);
assert (std::string("xyz0") == strings[0]);
assert (std::string("xyz") + number == strings[strings.size()-1]);
assert (BLOB("abc0") == blobs[0]);
BLOB blob("abc");
blob.appendRaw(number.c_str(), number.size());
assert (blob == blobs[blobs.size()-1]);
assert (.5 == floats[0]);
assert (floats.size() - 1 + .5 == floats[floats.size() - 1]);
assert (bools[0]);
assert (!bools[1]);
assert (bools[2]);
assert (!bools[3]);
ints.clear();
try
{
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
fail ("must fail");
}
catch(InvalidArgumentException&){ }
try
{
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
fail ("must fail");
}
catch(InvalidAccessException&){ }
ints.clear();
strings.clear();
blobs.clear();
floats.clear();
dateTimes.clear();
bools.clear();
try
{
session() << "SELECT * FROM MiscTest ORDER BY Third",
bulk(size),
into(strings),
into(blobs),
into(ints),
into(floats),
into(dateTimes),
into(bools),
now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (size == ints.size());
assert (0 == ints[0]);
assert (ints.size() - 1 == ints[ints.size()-1]);
assert (std::string("xyz0") == strings[0]);
assert (std::string("xyz") + number == strings[strings.size()-1]);
assert (BLOB("abc0") == blobs[0]);
blob.assignRaw("abc", 3);
blob.appendRaw(number.c_str(), number.size());
assert (blob == blobs[blobs.size()-1]);
assert (.5 == floats[0]);
assert (floats.size() - 1 + .5 == floats[floats.size() - 1]);
assert (bools[0]);
assert (!bools[1]);
assert (bools[2]);
assert (!bools[3]);
}
void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
{
std::string funct = "doBulk()";
@ -1691,11 +1552,10 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
{
sw.restart();
session() << "SELECT First, Third, Fourth, Fifth FROM MiscTest",
bulk(size),
into(strings),
into(ints),
into(floats),
into(dateTimes),
into(strings, bulk(size)),
into(ints, bulk(size)),
into(floats, bulk(size)),
into(dateTimes, bulk(size)),
now;
sw.stop();
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
@ -1818,12 +1678,11 @@ void SQLExecutor::doBulkNoBool(Poco::UInt32 size)
try
{
session() << "SELECT * FROM MiscTest ORDER BY First",
bulk(size),
into(strings),
into(blobs),
into(ints),
into(floats),
into(dateTimes),
into(strings, bulk(size)),
into(blobs, bulk(size)),
into(ints, bulk(size)),
into(floats, bulk(size)),
into(dateTimes, bulk(size)),
now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }

View File

@ -37,8 +37,12 @@
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/ODBC/Utility.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/BulkExtraction.h"
#include "Poco/Data/BulkBinding.h"
#include "Poco/NumberFormatter.h"
#include "Poco/Exception.h"
#define poco_odbc_check_env(r, h) \
@ -140,7 +144,144 @@ public:
void limitPrepare();
void limitZero();
void prepare();
void doBulk(Poco::UInt32 size);
template <typename C1, typename C2, typename C3, typename C4, typename C5, typename C6>
void doBulk(Poco::UInt32 size)
{
std::string funct = "doBulk()";
C1 ints;
C2 strings;
C3 blobs;
C4 floats;
C5 dateTimes(size);
C6 bools;
for (int i = 0; i < size; ++i)
{
ints.push_back(i);
strings.push_back(std::string("xyz" + Poco::NumberFormatter::format(i)));
blobs.push_back(std::string("abc") + Poco::NumberFormatter::format(i));
floats.push_back(i + .5);
bools.push_back(0 == i % 2);
}
try
{
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?,?)",
use(strings),
use(blobs),
use(ints),
use(floats),
use(dateTimes),
use(bools), now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { session() << "DELETE FROM MiscTest", now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try
{
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?,?)",
use(strings, bulk),
use(blobs, bulk),
use(ints, bulk),
use(floats, bulk),
use(dateTimes, bulk),
use(bools, bulk), now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
ints.clear();
strings.clear();
blobs.clear();
floats.clear();
dateTimes.clear();
bools.clear();
try
{
session() << "SELECT * FROM MiscTest ORDER BY Third",
into(strings),
into(blobs),
into(ints),
into(floats),
into(dateTimes),
into(bools),
now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
std::string number = Poco::NumberFormatter::format(size - 1);
assert (size == ints.size());
assert (0 == ints.front());
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");
blob.appendRaw(number.c_str(), number.size());
assert (blob == blobs.back());
assert (.5 == floats.front());
assert (floats.size() - 1 + .5 == floats.back());
assert (bools.front());
assert ((0 == ((bools.size() - 1) % 2) == bools.back()));
ints.clear();
try
{
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
fail ("must fail");
}
catch(Poco::InvalidArgumentException&){ }
try
{
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
fail ("must fail");
}
catch(Poco::InvalidAccessException&){ }
ints.clear();
strings.clear();
strings.resize(size);
blobs.clear();
floats.clear();
floats.resize(size);
dateTimes.clear();
bools.clear();
bools.resize(size);
try
{
session() << "SELECT First, Second, Third, Fourth, Fifth, Sixth FROM MiscTest ORDER BY Third",
into(strings, bulk),
into(blobs, bulk(size)),
into(ints, bulk(size)),
into(floats, bulk),
into(dateTimes, bulk(size)),
into(bools, bulk),
now;
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (size == ints.size());
assert (0 == ints.front());
assert (size - 1 == ints.back());
assert (std::string("xyz0") == strings.front());
assert (std::string("xyz") + number == strings.back());
assert (BLOB("abc0") == blobs.front());
blob.assignRaw("abc", 3);
blob.appendRaw(number.c_str(), number.size());
assert (blob == blobs.back());
assert (.5 == floats.front());
assert (floats.size() - 1 + .5 == floats.back());
assert (bools.front());
assert ((0 == ((bools.size() - 1) % 2) == bools.back()));
}
void doBulkPerformance(Poco::UInt32 size);
void doBulkNoBool(Poco::UInt32 size);
void doBulkStringIntFloat(Poco::UInt32 size);

View File

@ -41,26 +41,22 @@
#include "Poco/Data/Data.h"
#include "Poco/Data/Date.h"
#include "Poco/Data/Time.h"
#include "Poco/Data/BLOB.h"
#include "Poco/DateTime.h"
#include "Poco/Any.h"
#include "Poco/DynamicAny.h"
#include <vector>
#include <deque>
#include <list>
#include <cstddef>
namespace Poco {
class DateTime;
class Any;
class DynamicAny;
namespace Data {
class Date;
class Time;
class BLOB;
enum NullData
{
NULL_GENERIC = 0
@ -94,35 +90,71 @@ public:
virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN);
/// Binds an Int8 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN);
/// Binds an Int8 deque.
virtual void bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir = PD_IN);
/// Binds an Int8 list.
virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir = PD_IN) = 0;
/// Binds an UInt8.
virtual void bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir = PD_IN);
/// Binds an UInt8 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction dir = PD_IN);
/// Binds an UInt8 deque.
virtual void bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir = PD_IN);
/// Binds an UInt8 list.
virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir = PD_IN) = 0;
/// Binds an Int16.
virtual void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir = PD_IN);
/// Binds an Int16 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction dir = PD_IN);
/// Binds an Int16 deque.
virtual void bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir = PD_IN);
/// Binds an Int16 list.
virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir = PD_IN) = 0;
/// Binds an UInt16.
virtual void bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir = PD_IN);
/// Binds an UInt16 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Direction dir = PD_IN);
/// Binds an UInt16 deque.
virtual void bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir = PD_IN);
/// Binds an UInt16 list.
virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir = PD_IN) = 0;
/// Binds an Int32.
virtual void bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir = PD_IN);
/// Binds an Int32 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN);
/// Binds an Int32 deque.
virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN);
/// Binds an Int32 list.
virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir = PD_IN) = 0;
/// Binds an UInt32.
virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN);
/// Binds an UInt32 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN);
/// Binds an UInt32 deque.
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
/// Binds an UInt32 list.
virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir = PD_IN) = 0;
/// Binds an Int64.
@ -130,18 +162,36 @@ public:
virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN);
/// Binds an Int64 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN);
/// Binds an Int64 deque.
virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN);
/// Binds an Int64 list.
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN) = 0;
/// Binds an UInt64.
virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN);
/// Binds an UInt64 vector.
virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN);
/// Binds an UInt64 deque.
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
/// Binds an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0;
/// Binds a long.
virtual void bind(std::size_t pos, const std::vector<long>& val, Direction dir = PD_IN);
/// Binds a long vector.
virtual void bind(std::size_t pos, const std::deque<long>& val, Direction dir = PD_IN);
/// Binds a long deque.
virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN);
/// Binds a long list.
#endif
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0;
@ -150,24 +200,48 @@ public:
virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN);
/// Binds a boolean vector.
virtual void bind(std::size_t pos, const std::deque<bool>& val, Direction dir = PD_IN);
/// Binds a boolean deque.
virtual void bind(std::size_t pos, const std::list<bool>& val, Direction dir = PD_IN);
/// Binds a boolean list.
virtual void bind(std::size_t pos, const float& val, Direction dir = PD_IN) = 0;
/// Binds a float.
virtual void bind(std::size_t pos, const std::vector<float>& val, Direction dir = PD_IN);
/// Binds a float vector.
virtual void bind(std::size_t pos, const std::deque<float>& val, Direction dir = PD_IN);
/// Binds a float deque.
virtual void bind(std::size_t pos, const std::list<float>& val, Direction dir = PD_IN);
/// Binds a float list.
virtual void bind(std::size_t pos, const double& val, Direction dir = PD_IN) = 0;
/// Binds a double.
virtual void bind(std::size_t pos, const std::vector<double>& val, Direction dir = PD_IN);
/// Binds a double vector.
virtual void bind(std::size_t pos, const std::deque<double>& val, Direction dir = PD_IN);
/// Binds a double deque.
virtual void bind(std::size_t pos, const std::list<double>& val, Direction dir = PD_IN);
/// Binds a double list.
virtual void bind(std::size_t pos, const char& val, Direction dir = PD_IN) = 0;
/// Binds a single character.
virtual void bind(std::size_t pos, const std::vector<char>& val, Direction dir = PD_IN);
/// Binds a character vector.
virtual void bind(std::size_t pos, const std::deque<char>& val, Direction dir = PD_IN);
/// Binds a character deque.
virtual void bind(std::size_t pos, const std::list<char>& val, Direction dir = PD_IN);
/// Binds a character list.
virtual void bind(std::size_t pos, const char* const& pVal, Direction dir = PD_IN) = 0;
/// Binds a const char ptr.
@ -177,36 +251,72 @@ public:
virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN);
/// Binds a string vector.
virtual void bind(std::size_t pos, const std::deque<std::string>& val, Direction dir = PD_IN);
/// Binds a string deque.
virtual void bind(std::size_t pos, const std::list<std::string>& val, Direction dir = PD_IN);
/// Binds a string list.
virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN) = 0;
/// Binds a BLOB.
virtual void bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir = PD_IN);
/// Binds a BLOB vector.
virtual void bind(std::size_t pos, const std::deque<BLOB>& val, Direction dir = PD_IN);
/// Binds a BLOB deque.
virtual void bind(std::size_t pos, const std::list<BLOB>& val, Direction dir = PD_IN);
/// Binds a BLOB list.
virtual void bind(std::size_t pos, const DateTime& val, Direction dir = PD_IN) = 0;
/// Binds a DateTime.
virtual void bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir = PD_IN);
/// Binds a DateTime vector.
virtual void bind(std::size_t pos, const std::deque<DateTime>& val, Direction dir = PD_IN);
/// Binds a DateTime deque.
virtual void bind(std::size_t pos, const std::list<DateTime>& val, Direction dir = PD_IN);
/// Binds a DateTime list.
virtual void bind(std::size_t pos, const Date& val, Direction dir = PD_IN) = 0;
/// Binds a Date.
virtual void bind(std::size_t pos, const std::vector<Date>& val, Direction dir = PD_IN);
/// Binds a Date vector.
virtual void bind(std::size_t pos, const std::deque<Date>& val, Direction dir = PD_IN);
/// Binds a Date deque.
virtual void bind(std::size_t pos, const std::list<Date>& val, Direction dir = PD_IN);
/// Binds a Date list.
virtual void bind(std::size_t pos, const Time& val, Direction dir = PD_IN) = 0;
/// Binds a Time.
virtual void bind(std::size_t pos, const std::vector<Time>& val, Direction dir = PD_IN);
/// Binds a Time vector.
virtual void bind(std::size_t pos, const std::deque<Time>& val, Direction dir = PD_IN);
/// Binds a Time deque.
virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN);
/// Binds a Time list.
virtual void bind(std::size_t pos, const NullData& val, Direction dir = PD_IN) = 0;
/// Binds a null.
virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN);
/// Binds a null vector.
virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN);
/// Binds a null deque.
virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN);
/// Binds a null list.
void bind(std::size_t pos, const Any& val, Direction dir = PD_IN);
/// Binds an Any.

View File

@ -42,6 +42,9 @@
#include "Poco/Data/Data.h"
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <cstddef>
@ -78,11 +81,23 @@ public:
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
/// Extracts an Int8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
/// Extracts an Int8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val);
/// Extracts an Int8 list.
virtual bool extract(std::size_t pos, Poco::UInt8& val) = 0;
/// Extracts an UInt8. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
/// Extracts an UInt8vector .
/// Extracts an UInt8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
/// Extracts an UInt8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
/// Extracts an UInt8 list.
virtual bool extract(std::size_t pos, Poco::Int16& val) = 0;
/// Extracts an Int16. Returns false if null was received.
@ -90,42 +105,84 @@ public:
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
/// Extracts an Int16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
/// Extracts an Int16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val);
/// Extracts an Int16 list.
virtual bool extract(std::size_t pos, Poco::UInt16& val) = 0;
/// Extracts an UInt16. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
/// Extracts an UInt16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
/// Extracts an UInt16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
/// Extracts an UInt16 list.
virtual bool extract(std::size_t pos, Poco::Int32& val) = 0;
/// Extracts an Int32. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
/// Extracts an Int32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
/// Extracts an Int32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val);
/// Extracts an Int32 list.
virtual bool extract(std::size_t pos, Poco::UInt32& val) = 0;
/// Extracts an UInt32. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
/// Extracts an UInt32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
/// Extracts an UInt32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
/// Extracts an UInt32 list.
virtual bool extract(std::size_t pos, Poco::Int64& val) = 0;
/// Extracts an Int64. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
/// Extracts an Int64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
/// Extracts an Int64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val);
/// Extracts an Int64 list.
virtual bool extract(std::size_t pos, Poco::UInt64& val) = 0;
/// Extracts an UInt64. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
/// Extracts an UInt64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
/// Extracts an UInt64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual bool extract(std::size_t pos, long& val) = 0;
/// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<long>& val);
/// Extracts a long vector.
virtual bool extract(std::size_t pos, std::deque<long>& val);
/// Extracts a long deque.
virtual bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, bool& val) = 0;
@ -134,66 +191,132 @@ public:
virtual bool extract(std::size_t pos, std::vector<bool>& val);
/// Extracts a boolean vector.
virtual bool extract(std::size_t pos, std::deque<bool>& val);
/// Extracts a boolean deque.
virtual bool extract(std::size_t pos, std::list<bool>& val);
/// Extracts a boolean list.
virtual bool extract(std::size_t pos, float& val) = 0;
/// Extracts a float. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<float>& val);
/// Extracts a float vector.
virtual bool extract(std::size_t pos, std::deque<float>& val);
/// Extracts a float deque.
virtual bool extract(std::size_t pos, std::list<float>& val);
/// Extracts a float list.
virtual bool extract(std::size_t pos, double& val) = 0;
/// Extracts a double. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<double>& val);
/// Extracts a double vector.
virtual bool extract(std::size_t pos, std::deque<double>& val);
/// Extracts a double deque.
virtual bool extract(std::size_t pos, std::list<double>& val);
/// Extracts a double list.
virtual bool extract(std::size_t pos, char& val) = 0;
/// Extracts a single character. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<char>& val);
/// Extracts a character vector.
virtual bool extract(std::size_t pos, std::deque<char>& val);
/// Extracts a character deque.
virtual bool extract(std::size_t pos, std::list<char>& val);
/// Extracts a character list.
virtual bool extract(std::size_t pos, std::string& val) = 0;
/// Extracts a string. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<std::string>& val);
/// Extracts a string vector.
virtual bool extract(std::size_t pos, std::deque<std::string>& val);
/// Extracts a string deque.
virtual bool extract(std::size_t pos, std::list<std::string>& val);
/// Extracts a string list.
virtual bool extract(std::size_t pos, BLOB& val) = 0;
/// Extracts a BLOB. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<BLOB>& val);
/// Extracts a BLOB vector.
virtual bool extract(std::size_t pos, std::deque<BLOB>& val);
/// Extracts a BLOB deque.
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, DateTime& val) = 0;
/// Extracts a DateTime. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<DateTime>& val);
/// Extracts a DateTime vector.
virtual bool extract(std::size_t pos, std::deque<DateTime>& val);
/// Extracts a DateTime deque.
virtual bool extract(std::size_t pos, std::list<DateTime>& val);
/// Extracts a DateTime list.
virtual bool extract(std::size_t pos, Date& val) = 0;
/// Extracts a Date. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Date>& val);
/// Extracts a Date vector.
virtual bool extract(std::size_t pos, std::deque<Date>& val);
/// Extracts a Date deque.
virtual bool extract(std::size_t pos, std::list<Date>& val);
/// Extracts a Date list.
virtual bool extract(std::size_t pos, Time& val) = 0;
/// Extracts a Time. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Time>& val);
/// Extracts a Time vector.
virtual bool extract(std::size_t pos, std::deque<Time>& val);
/// Extracts a Time deque.
virtual bool extract(std::size_t pos, std::list<Time>& val);
/// Extracts a Time list.
virtual bool extract(std::size_t pos, Any& val) = 0;
/// Extracts an Any. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Any>& val);
/// Extracts an Any vector.
virtual bool extract(std::size_t pos, std::deque<Any>& val);
/// Extracts an Any deque.
virtual bool extract(std::size_t pos, std::list<Any>& val);
/// Extracts an Any list.
virtual bool extract(std::size_t pos, DynamicAny& val) = 0;
/// Extracts a DynamicAny. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<DynamicAny>& val);
/// Extracts a DynamicAny vector.
virtual bool extract(std::size_t pos, std::deque<DynamicAny>& val);
/// Extracts a DynamicAny deque.
virtual bool extract(std::size_t pos, std::list<DynamicAny>& val);
/// Extracts a DynamicAny list.
virtual bool isNull(std::size_t col, std::size_t row = -1) = 0;
/// Returns true if the value at [col,row] position is null.

View File

@ -43,6 +43,8 @@
#include "Poco/Data/Data.h"
#include "Poco/RefCountedObject.h"
#include <vector>
#include <deque>
#include <list>
#include <cstddef>
@ -84,54 +86,108 @@ public:
virtual void prepare(std::size_t pos, std::vector<Poco::Int8>& val);
/// Prepares an Int8 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::Int8>& val);
/// Prepares an Int8 deque.
virtual void prepare(std::size_t pos, std::list<Poco::Int8>& val);
/// Prepares an Int8 list.
virtual void prepare(std::size_t pos, Poco::UInt8&) = 0;
/// Prepares an UInt8.
virtual void prepare(std::size_t pos, std::vector<Poco::UInt8>& val);
/// Prepares an UInt8 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::UInt8>& val);
/// Prepares an UInt8 deque.
virtual void prepare(std::size_t pos, std::list<Poco::UInt8>& val);
/// Prepares an UInt8 list.
virtual void prepare(std::size_t pos, Poco::Int16&) = 0;
/// Prepares an Int16.
virtual void prepare(std::size_t pos, std::vector<Poco::Int16>& val);
/// Prepares an Int16 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::Int16>& val);
/// Prepares an Int16 deque.
virtual void prepare(std::size_t pos, std::list<Poco::Int16>& val);
/// Prepares an Int16 list.
virtual void prepare(std::size_t pos, Poco::UInt16&) = 0;
/// Prepares an UInt16.
virtual void prepare(std::size_t pos, std::vector<Poco::UInt16>& val);
/// Prepares an UInt16 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::UInt16>& val);
/// Prepares an UInt16 deque.
virtual void prepare(std::size_t pos, std::list<Poco::UInt16>& val);
/// Prepares an UInt16 list.
virtual void prepare(std::size_t pos, Poco::Int32&) = 0;
/// Prepares an Int32.
virtual void prepare(std::size_t pos, std::vector<Poco::Int32>& val);
/// Prepares an Int32 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::Int32>& val);
/// Prepares an Int32 deque.
virtual void prepare(std::size_t pos, std::list<Poco::Int32>& val);
/// Prepares an Int32 list.
virtual void prepare(std::size_t pos, Poco::UInt32&) = 0;
/// Prepares an UInt32.
virtual void prepare(std::size_t pos, std::vector<Poco::UInt32>& val);
/// Prepares an UInt32 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::UInt32>& val);
/// Prepares an UInt32 deque.
virtual void prepare(std::size_t pos, std::list<Poco::UInt32>& val);
/// Prepares an UInt32 list.
virtual void prepare(std::size_t pos, Poco::Int64&) = 0;
/// Prepares an Int64.
virtual void prepare(std::size_t pos, std::vector<Poco::Int64>& val);
/// Prepares an Int64 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::Int64>& val);
/// Prepares an Int64 deque.
virtual void prepare(std::size_t pos, std::list<Poco::Int64>& val);
/// Prepares an Int64 list.
virtual void prepare(std::size_t pos, Poco::UInt64&) = 0;
/// Prepares an UInt64.
virtual void prepare(std::size_t pos, std::vector<Poco::UInt64>& val);
/// Prepares an UInt64 vector.
virtual void prepare(std::size_t pos, std::deque<Poco::UInt64>& val);
/// Prepares an UInt64 deque.
virtual void prepare(std::size_t pos, std::list<Poco::UInt64>& val);
/// Prepares an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual void prepare(std::size_t pos, long&) = 0;
/// Prepares a long.
virtual void prepare(std::size_t pos, std::vector<long>& val);
/// Prepares a long vector.
virtual void prepare(std::size_t pos, std::deque<long>& val);
/// Prepares a long deque.
virtual void prepare(std::size_t pos, std::list<long>& val);
/// Prepares a long list.
#endif
virtual void prepare(std::size_t pos, bool&) = 0;
@ -140,35 +196,71 @@ public:
virtual void prepare(std::size_t pos, std::vector<bool>& val);
/// Prepares a boolean vector.
virtual void prepare(std::size_t pos, std::deque<bool>& val);
/// Prepares a boolean deque.
virtual void prepare(std::size_t pos, std::list<bool>& val);
/// Prepares a boolean list.
virtual void prepare(std::size_t pos, float&) = 0;
/// Prepares a float.
virtual void prepare(std::size_t pos, std::vector<float>& val);
/// Prepares a float vector.
virtual void prepare(std::size_t pos, std::deque<float>& val);
/// Prepares a float deque.
virtual void prepare(std::size_t pos, std::list<float>& val);
/// Prepares a float list.
virtual void prepare(std::size_t pos, double&) = 0;
/// Prepares a double.
virtual void prepare(std::size_t pos, std::vector<double>& val);
/// Prepares a double vector.
virtual void prepare(std::size_t pos, std::deque<double>& val);
/// Prepares a double deque.
virtual void prepare(std::size_t pos, std::list<double>& val);
/// Prepares a double list.
virtual void prepare(std::size_t pos, char&) = 0;
/// Prepares a single character.
virtual void prepare(std::size_t pos, std::vector<char>& val);
/// Prepares a character vector.
virtual void prepare(std::size_t pos, std::deque<char>& val);
/// Prepares a character deque.
virtual void prepare(std::size_t pos, std::list<char>& val);
/// Prepares a character list.
virtual void prepare(std::size_t pos, const std::string&) = 0;
/// Prepares a string.
virtual void prepare(std::size_t pos, const std::vector<std::string>& val);
/// Prepares a string vector.
virtual void prepare(std::size_t pos, const std::deque<std::string>& val);
/// Prepares a string deque.
virtual void prepare(std::size_t pos, const std::list<std::string>& val);
/// Prepares a string list.
virtual void prepare(std::size_t pos, const BLOB&) = 0;
/// Prepares a BLOB.
virtual void prepare(std::size_t pos, const std::vector<BLOB>& val);
/// Prepares a BLOB vector.
virtual void prepare(std::size_t pos, const std::deque<BLOB>& val);
/// Prepares a BLOB deque.
virtual void prepare(std::size_t pos, const std::list<BLOB>& val);
/// Prepares a BLOB list.
virtual void prepare(std::size_t pos, const DateTime&) = 0;
/// Prepares a DateTime.
@ -176,30 +268,60 @@ public:
virtual void prepare(std::size_t pos, const std::vector<DateTime>& val);
/// Prepares a DateTime vector.
virtual void prepare(std::size_t pos, const std::deque<DateTime>& val);
/// Prepares a DateTime deque.
virtual void prepare(std::size_t pos, const std::list<DateTime>& val);
/// Prepares a DateTime list.
virtual void prepare(std::size_t pos, const Date&) = 0;
/// Prepares a Date.
virtual void prepare(std::size_t pos, const std::vector<Date>& val);
/// Prepares a Date vector.
virtual void prepare(std::size_t pos, const std::deque<Date>& val);
/// Prepares a Date deque.
virtual void prepare(std::size_t pos, const std::list<Date>& val);
/// Prepares a Date list.
virtual void prepare(std::size_t pos, const Time&) = 0;
/// Prepares a Time.
virtual void prepare(std::size_t pos, const std::vector<Time>& val);
/// Prepares a Time vector.
virtual void prepare(std::size_t pos, const std::deque<Time>& val);
/// Prepares a Time deque.
virtual void prepare(std::size_t pos, const std::list<Time>& val);
/// Prepares a Time list.
virtual void prepare(std::size_t pos, const Any&) = 0;
/// Prepares an Any.
virtual void prepare(std::size_t pos, const std::vector<Any>& val);
/// Prepares an Any vector.
virtual void prepare(std::size_t pos, const std::deque<Any>& val);
/// Prepares an Any deque.
virtual void prepare(std::size_t pos, const std::list<Any>& val);
/// Prepares an Any list.
virtual void prepare(std::size_t pos, const DynamicAny&) = 0;
/// Prepares a DynamicAny.
virtual void prepare(std::size_t pos, const std::vector<DynamicAny>& val);
/// Prepares a DynamicAny vector.
virtual void prepare(std::size_t pos, const std::deque<DynamicAny>& val);
/// Prepares a DynamicAny deque.
virtual void prepare(std::size_t pos, const std::list<DynamicAny>& val);
/// Prepares a DynamicAny list.
void setLength(Poco::UInt32 length);
/// Sets the length of prepared data.
/// Needed only for data lengths greater than 1 (i.e. for

View File

@ -103,6 +103,9 @@ inline void bulk()
}
typedef void (*BulkFnType)();
} } // namespace Poco::Data

View File

@ -44,7 +44,10 @@
#include "Poco/Data/AbstractBinding.h"
#include "Poco/Data/DataException.h"
#include "Poco/Data/TypeHandler.h"
#include "Poco/Data/Bulk.h"
#include <vector>
#include <deque>
#include <list>
#include <cstddef>
@ -65,7 +68,7 @@ public:
/// Creates the BulkBinding.
{
if (0 == _val.size())
throw InvalidArgumentException("Zero size containers not allowed.");
throw BindingException("Zero size containers not allowed.");
}
~BulkBinding()
@ -107,11 +110,9 @@ private:
};
typedef void (*BulkFnType)();
template <typename T>
BulkBinding<std::vector<T> >* use(const std::vector<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation.
/// Convenience function for a more compact BulkBinding creation for std::vector.
{
return new BulkBinding<std::vector<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
@ -119,12 +120,44 @@ BulkBinding<std::vector<T> >* use(const std::vector<T>& t, BulkFnType, const std
template <typename T>
BulkBinding<std::vector<T> >* in(const std::vector<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation.
/// Convenience function for a more compact BulkBinding creation for std::vector.
{
return new BulkBinding<std::vector<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
template <typename T>
BulkBinding<std::deque<T> >* use(const std::deque<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::deque.
{
return new BulkBinding<std::deque<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
template <typename T>
BulkBinding<std::deque<T> >* in(const std::deque<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::deque.
{
return new BulkBinding<std::deque<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
template <typename T>
BulkBinding<std::list<T> >* use(const std::list<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::list.
{
return new BulkBinding<std::list<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
template <typename T>
BulkBinding<std::list<T> >* in(const std::list<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::list.
{
return new BulkBinding<std::list<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
}
} } // namespace Poco::Data

View File

@ -144,6 +144,17 @@ BulkExtraction<std::vector<T> >* into(std::vector<T>& t, const Bulk& bulk)
}
template <typename T>
BulkExtraction<std::vector<T> >* into(std::vector<T>& t, BulkFnType)
/// Convenience function to allow for a more compact creation of an extraction object
/// with std::vector bulk extraction support.
{
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
return new BulkExtraction<std::vector<T> >(t, size);
}
template <typename T>
BulkExtraction<std::deque<T> >* into(std::deque<T>& t, const Bulk& bulk)
/// Convenience function to allow for a more compact creation of an extraction object
@ -153,6 +164,17 @@ BulkExtraction<std::deque<T> >* into(std::deque<T>& t, const Bulk& bulk)
}
template <typename T>
BulkExtraction<std::deque<T> >* into(std::deque<T>& t, BulkFnType)
/// Convenience function to allow for a more compact creation of an extraction object
/// with std::deque bulk extraction support.
{
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
return new BulkExtraction<std::deque<T> >(t, size);
}
template <typename T>
BulkExtraction<std::list<T> >* into(std::list<T>& t, const Bulk& bulk)
/// Convenience function to allow for a more compact creation of an extraction object
@ -162,6 +184,17 @@ BulkExtraction<std::list<T> >* into(std::list<T>& t, const Bulk& bulk)
}
template <typename T>
BulkExtraction<std::list<T> >* into(std::list<T>& t, BulkFnType)
/// Convenience function to allow for a more compact creation of an extraction object
/// with std::list bulk extraction support.
{
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
return new BulkExtraction<std::list<T> >(t, size);
}
} } // namespace Poco::Data

View File

@ -790,7 +790,15 @@ private:
template <typename T>
Extraction<T>* into(T& t, const Position& pos = 0)
Extraction<T>* into(T& t)
/// Convenience function to allow for a more compact creation of an extraction object.
{
return new Extraction<T>(t);
}
template <typename T>
Extraction<T>* into(T& t, const Position& pos)
/// Convenience function to allow for a more compact creation of an extraction object
/// with multiple recordset support.
{

View File

@ -56,6 +56,7 @@
#include <vector>
#include <list>
#include <deque>
#include <string>
#include <sstream>
@ -116,7 +117,8 @@ public:
virtual ~StatementImpl();
/// Destroys the StatementImpl.
template <typename T> void add(const T& t)
template <typename T>
void add(const T& t)
/// Appends SQL statement (fragments).
{
_ostr << t;
@ -275,7 +277,7 @@ protected:
private:
void compile();
/// Compiles the statement, if not yet compiled. doesn't bind yet
/// Compiles the statement, if not yet compiled.
void bind();
/// Binds the statement, if not yet bound.

View File

@ -64,53 +64,161 @@ void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::Int8>& val, D
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
#ifndef POCO_LONG_IS_64_BIT
void AbstractBinder::bind(std::size_t pos, const std::vector<long>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<long>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<long>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
#endif
@ -120,60 +228,180 @@ void AbstractBinder::bind(std::size_t pos, const std::vector<bool>& val, Directi
}
void AbstractBinder::bind(std::size_t pos, const std::deque<bool>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<bool>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<float>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<float>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<float>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<double>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<double>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<double>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<char>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<char>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<char>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<std::string>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<BLOB>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<BLOB>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<DateTime>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<DateTime>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Date>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Date>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Date>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Time>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Time>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Time>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<NullData>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<NullData>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<NullData>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const Any& val, Direction dir)
{
const std::type_info& type = val.type();

View File

@ -58,53 +58,161 @@ bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#ifndef POCO_LONG_IS_64_BIT
bool AbstractExtractor::extract(std::size_t pos, std::vector<long>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<long>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<long>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif
@ -114,64 +222,196 @@ bool AbstractExtractor::extract(std::size_t pos, std::vector<bool>& val)
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<bool>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<bool>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<float>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<float>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<float>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<double>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<double>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<double>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<char>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<char>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<char>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<std::string>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<std::string>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<std::string>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<BLOB>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<BLOB>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<BLOB>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<DateTime>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<DateTime>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<DateTime>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Date>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Date>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Date>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Time>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Time>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Time>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Any>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Any>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Any>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<DynamicAny>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<DynamicAny>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<DynamicAny>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
} } // namespace Poco::Data

View File

@ -58,120 +58,360 @@ void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::Int8>& val)
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::Int8>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::Int8>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::UInt8>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::UInt8>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::UInt8>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::Int16>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::Int16>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::Int16>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::UInt16>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::UInt16>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::UInt16>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::Int32>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::Int32>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::Int32>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::UInt32>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::UInt32>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::UInt32>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::Int64>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::Int64>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::Int64>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<Poco::UInt64>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<Poco::UInt64>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<Poco::UInt64>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
#ifndef POCO_LONG_IS_64_BIT
void AbstractPreparation::prepare(std::size_t pos, std::vector<long>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::deque<long>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<long>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
#endif
void AbstractPreparation::prepare(std::size_t pos, std::vector<bool>& val)
void AbstractPreparation::prepare(std::size_t pos, std::vector<bool>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<float>& val)
void AbstractPreparation::prepare(std::size_t pos, std::deque<bool>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<bool>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<float>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<double>& val)
void AbstractPreparation::prepare(std::size_t pos, std::deque<float>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<float>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<double>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<char>& val)
void AbstractPreparation::prepare(std::size_t pos, std::deque<double>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<double>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::vector<char>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<std::string>& val)
void AbstractPreparation::prepare(std::size_t pos, std::deque<char>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, std::list<char>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<std::string>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<BLOB>& val)
void AbstractPreparation::prepare(std::size_t pos, const std::deque<std::string>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<std::string>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<BLOB>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<DateTime>& val)
void AbstractPreparation::prepare(std::size_t pos, const std::deque<BLOB>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<BLOB>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<DateTime>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Date>& val)
void AbstractPreparation::prepare(std::size_t pos, const std::deque<DateTime>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<DateTime>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Date>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Time>& val)
void AbstractPreparation::prepare(std::size_t pos, const std::deque<Date>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<Date>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Time>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Any>& val)
void AbstractPreparation::prepare(std::size_t pos, const std::deque<Time>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<Time>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<Any>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::deque<Any>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<Any>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::vector<DynamicAny>& val)
{
throw NotImplementedException("std::vector preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::deque<DynamicAny>& val)
{
throw NotImplementedException("std::deque preparation must be implemented.");
}
void AbstractPreparation::prepare(std::size_t pos, const std::list<DynamicAny>& val)
{
throw NotImplementedException("std::list preparation must be implemented.");
}
} } // namespace Poco::Data