mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-19 03:14:50 +00:00
Refactor string extractors to remove duplicate code, fix logic errors… (#2301)
* Refactor string extractors to remove duplicate code, fix logic errors and reduce the number of calls to SQLGetData(). * fix conflict * fixed conflict * merge from develop * implement bulk insert of containers with nullable values * fixing build error * Delaying the creating of extractors until the statement is executed because SybaseIQ is not returning the correct column data until execution
This commit is contained in:
committed by
Aleksandar Fabijanic
parent
8a70ab8a1c
commit
56652302f0
@@ -143,6 +143,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::Int8> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int8 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int8> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int8 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an UInt8.
|
||||
|
||||
@@ -155,6 +164,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::UInt8> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt8 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt8> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt8 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an Int16.
|
||||
|
||||
@@ -167,6 +185,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::Int16> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int16 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int16> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int16 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an UInt16.
|
||||
|
||||
@@ -179,6 +206,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::UInt16> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt16 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt16> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt16 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an Int32.
|
||||
|
||||
@@ -191,6 +227,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::Int32> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int32 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int32> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int32 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an UInt32.
|
||||
|
||||
@@ -203,6 +248,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::UInt32> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt32 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt32> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt32 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an Int64.
|
||||
|
||||
@@ -215,6 +269,15 @@ public:
|
||||
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 std::vector<Nullable<Poco::Int64> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int64 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int64> >& val, Direction dir = PD_IN);
|
||||
/// Binds an Int64 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds an UInt64.
|
||||
|
||||
@@ -227,6 +290,15 @@ public:
|
||||
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt64 list.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::UInt64> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt64 vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt64> >& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt64 deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a long.
|
||||
@@ -242,6 +314,15 @@ public:
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN);
|
||||
/// Binds a long list.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<Nullable<long> >& val, Direction dir = PD_IN);
|
||||
/// Binds a long vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<long> >& val, Direction dir = PD_IN);
|
||||
/// Binds a long deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
@@ -256,6 +337,16 @@ public:
|
||||
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 std::vector<Nullable<bool> >& val, Direction dir = PD_IN);
|
||||
/// Binds a boolean vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<bool> >& val, Direction dir = PD_IN);
|
||||
/// Binds a boolean deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<bool> >& val, Direction dir = PD_IN);
|
||||
/// Binds a boolean list.
|
||||
|
||||
virtual void bind(std::size_t pos, const float& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a float.
|
||||
|
||||
@@ -268,6 +359,15 @@ public:
|
||||
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 std::vector<Nullable<float> >& val, Direction dir = PD_IN);
|
||||
/// Binds a float vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<float> >& val, Direction dir = PD_IN);
|
||||
/// Binds a float deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<float> >& val, Direction dir = PD_IN);
|
||||
/// Binds a float list.
|
||||
|
||||
virtual void bind(std::size_t pos, const double& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a double.
|
||||
|
||||
@@ -280,6 +380,15 @@ public:
|
||||
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 std::vector<Nullable<double> >& val, Direction dir = PD_IN);
|
||||
/// Binds a double vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<double> >& val, Direction dir = PD_IN);
|
||||
/// Binds a double deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<double> >& val, Direction dir = PD_IN);
|
||||
/// Binds a double list.
|
||||
|
||||
virtual void bind(std::size_t pos, const char& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a single character.
|
||||
|
||||
@@ -292,6 +401,15 @@ public:
|
||||
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 std::vector<Nullable<char> >& val, Direction dir = PD_IN);
|
||||
/// Binds a character vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<char> >& val, Direction dir = PD_IN);
|
||||
/// Binds a character deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<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, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a const char ptr.
|
||||
|
||||
@@ -307,6 +425,15 @@ public:
|
||||
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 std::vector<Nullable<std::string> >& val, Direction dir = PD_IN);
|
||||
/// Binds a string vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<std::string> >& val, Direction dir = PD_IN);
|
||||
/// Binds a string deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<std::string> >& val, Direction dir = PD_IN);
|
||||
/// Binds a string list.
|
||||
|
||||
virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb());
|
||||
/// Binds a UTF-16 Unicode string.
|
||||
|
||||
@@ -319,6 +446,15 @@ public:
|
||||
virtual void bind(std::size_t pos, const std::list<UTF16String>& val, Direction dir = PD_IN);
|
||||
/// Binds a UTF-16 Unicode string list.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<Nullable<UTF16String> >& val, Direction dir = PD_IN);
|
||||
/// Binds a UTF-16 Unicode string vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<UTF16String> >& val, Direction dir = PD_IN);
|
||||
/// Binds a UTF-16 Unicode string deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<UTF16String> >& val, Direction dir = PD_IN);
|
||||
/// Binds a UTF-16 Unicode string list.
|
||||
|
||||
virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a BLOB.
|
||||
|
||||
@@ -334,6 +470,15 @@ public:
|
||||
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 std::vector<Nullable<BLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a BLOB vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<BLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a BLOB deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<BLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a BLOB list.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir = PD_IN);
|
||||
/// Binds a CLOB vector.
|
||||
|
||||
@@ -343,6 +488,15 @@ public:
|
||||
virtual void bind(std::size_t pos, const std::list<CLOB>& val, Direction dir = PD_IN);
|
||||
/// Binds a CLOB list.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<Nullable<CLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a CLOB vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<CLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a CLOB deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<CLOB> >& val, Direction dir = PD_IN);
|
||||
/// Binds a CLOB list.
|
||||
|
||||
virtual void bind(std::size_t pos, const DateTime& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a DateTime.
|
||||
|
||||
@@ -355,6 +509,15 @@ public:
|
||||
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 std::vector<Nullable<DateTime> >& val, Direction dir = PD_IN);
|
||||
/// Binds a DateTime vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<DateTime> >& val, Direction dir = PD_IN);
|
||||
/// Binds a DateTime deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<DateTime> >& val, Direction dir = PD_IN);
|
||||
/// Binds a DateTime list.
|
||||
|
||||
virtual void bind(std::size_t pos, const Date& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a Date.
|
||||
|
||||
@@ -367,6 +530,15 @@ public:
|
||||
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 std::vector<Nullable<Date> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Date vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Date> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Date deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<Date> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Date list.
|
||||
|
||||
virtual void bind(std::size_t pos, const Time& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0;
|
||||
/// Binds a Time.
|
||||
|
||||
@@ -379,6 +551,15 @@ public:
|
||||
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 std::vector<Nullable<Time> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Time vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<Nullable<Time> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Time deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<Nullable<Time> >& val, Direction dir = PD_IN);
|
||||
/// Binds a Time list.
|
||||
|
||||
virtual void bind(std::size_t pos, const NullData& val, Direction dir = PD_IN, const std::type_info& bindType = typeid(void)) = 0;
|
||||
/// Binds a null.
|
||||
|
||||
|
||||
@@ -139,6 +139,54 @@ AbstractBinding::Ptr in(const std::list<T>& t, BulkFnType, const std::string& na
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr use(const std::vector<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::vector.
|
||||
{
|
||||
return new BulkBinding<std::vector<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr in(const std::vector<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::vector.
|
||||
{
|
||||
return new BulkBinding<std::vector<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr use(const std::deque<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::deque.
|
||||
{
|
||||
return new BulkBinding<std::deque<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr in(const std::deque<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::deque.
|
||||
{
|
||||
return new BulkBinding<std::deque<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr use(const std::list<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::list.
|
||||
{
|
||||
return new BulkBinding<std::list<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
AbstractBinding::Ptr in(const std::list<Nullable<T> >& t, BulkFnType, const std::string& name = "")
|
||||
/// Convenience function for a more compact BulkBinding creation for std::list.
|
||||
{
|
||||
return new BulkBinding<std::list<Nullable<T> > >(t, static_cast<Poco::UInt32>(t.size()), name);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
|
||||
@@ -254,7 +254,10 @@ protected:
|
||||
void setTotalRowCount(std::size_t totalRowCount);
|
||||
/// Explicitly sets the total row count.
|
||||
|
||||
void makeExtractors(std::size_t count);
|
||||
virtual bool canMakeExtractors();
|
||||
/// Returns true if extractors can be created.
|
||||
|
||||
virtual void makeExtractors(std::size_t count);
|
||||
/// Determines the type of the internal extraction container and
|
||||
/// calls the extraction creation function (addInternalExtract)
|
||||
/// with appropriate data type and container type arguments.
|
||||
|
||||
@@ -249,6 +249,110 @@ private:
|
||||
TypeHandler& operator = (const TypeHandler&);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class TypeHandler<std::deque<Nullable<T> > >: public AbstractTypeHandler
|
||||
/// Specialization of type handler for std::deque.
|
||||
{
|
||||
public:
|
||||
static void bind(std::size_t pos, const std::deque<Nullable<T> >& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
poco_assert_dbg (!pBinder.isNull());
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, std::deque<Nullable<T> >& obj, const T& defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
poco_assert_dbg (!pExt.isNull());
|
||||
if (!pExt->extract(pos, obj))
|
||||
obj.assign(obj.size(), defVal);
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, const std::deque<Nullable<T> >& obj, AbstractPreparator::Ptr pPreparator)
|
||||
{
|
||||
poco_assert_dbg (!pPreparator.isNull());
|
||||
pPreparator->prepare(pos, obj);
|
||||
}
|
||||
|
||||
private:
|
||||
TypeHandler(const TypeHandler&);
|
||||
TypeHandler& operator = (const TypeHandler&);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class TypeHandler<std::vector<Nullable<T> > >: public AbstractTypeHandler
|
||||
/// Specialization of type handler for std::vector.
|
||||
{
|
||||
public:
|
||||
static void bind(std::size_t pos, const std::vector<Nullable<T> >& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
poco_assert_dbg (!pBinder.isNull());
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, std::vector<Nullable<T> >& obj, const T& defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
poco_assert_dbg (!pExt.isNull());
|
||||
if (!pExt->extract(pos, obj))
|
||||
obj.assign(obj.size(), defVal);
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, const std::vector<Nullable<T> >& obj, AbstractPreparator::Ptr pPreparator)
|
||||
{
|
||||
poco_assert_dbg (!pPreparator.isNull());
|
||||
pPreparator->prepare(pos, obj);
|
||||
}
|
||||
|
||||
private:
|
||||
TypeHandler(const TypeHandler&);
|
||||
TypeHandler& operator = (const TypeHandler&);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class TypeHandler<std::list<Nullable<T> > >: public AbstractTypeHandler
|
||||
/// Specialization of type handler for std::list.
|
||||
{
|
||||
public:
|
||||
static void bind(std::size_t pos, const std::list<Nullable<T> >& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
poco_assert_dbg (!pBinder.isNull());
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, std::list<Nullable<T> >& obj, const T& defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
poco_assert_dbg (!pExt.isNull());
|
||||
if (!pExt->extract(pos, obj))
|
||||
obj.assign(obj.size(), defVal);
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, const std::list<Nullable<T> >& obj, AbstractPreparator::Ptr pPreparator)
|
||||
{
|
||||
poco_assert_dbg (!pPreparator.isNull());
|
||||
pPreparator->prepare(pos, obj);
|
||||
}
|
||||
|
||||
private:
|
||||
TypeHandler(const TypeHandler&);
|
||||
TypeHandler& operator = (const TypeHandler&);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class TypeHandler<Nullable<T> >
|
||||
/// Specialization of type handler for Nullable.
|
||||
|
||||
Reference in New Issue
Block a user