Insert NULL using BULK #4001 (#4755)

* fix(ODBC): Insert NULL using BULK #4001
resolve bound types and sizes at compile time

* fix: remove string suffix for static_assert

* Insert NULL using BULK #4001

* fix: typo

* fix(SQLite): missing functions; consolidate extract calls

* chore(SQLite): remove unnecessary typedef

* fix(SQLite): remove duplicate functions

* fix(SQLite): compile errors and warnings

* fix(SQLite): extract implementation signatures

* fix(SQLite): long64 platforms compile errors

* fix(SQLite): long64 platforms compile errors, part ii

* fix(ODBC): windows build

* fix(ODBC): MSSQL big string on windows

* fix(Data): psql and mysql compile errors

* fix(PostgreSQL): add missing functions

* fix(ODBC): revert column size discovery (breaks Oracle)

* fix(PostgreSQL): Nullable extraction #4001

* fix(MySQL): Nullable extraction #4001

* chore(Data): code tidy up

* fix(ODBC): add missing changes
This commit is contained in:
Aleksandar Fabijanic 2024-11-11 11:23:21 -06:00 committed by GitHub
parent fe9c13102d
commit 9530a77347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 5512 additions and 1313 deletions

View File

@ -242,6 +242,7 @@ public:
"SELECT * FROM Vectors ORDER BY int0 ASC",
const std::string& intFldName = "int0");
void nullBulk(const std::string& blobPlaceholder = "?"s);
void internalBulkExtraction();
void internalBulkExtractionUTF16();
void internalStorageType();

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,8 @@
#include "Poco/Data/MySQL/ResultMetadata.h"
#include "Poco/Data/AbstractExtractor.h"
#include "Poco/Data/LOB.h"
#include "Poco/Dynamic/Var.h"
#include "Poco/Nullable.h"
namespace Poco {
@ -48,276 +50,359 @@ public:
virtual ~Extractor();
/// Destroys the Extractor.
virtual bool extract(std::size_t pos, Poco::Int8& val);
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
virtual bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
virtual bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
virtual bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
virtual bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
virtual bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
virtual bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
virtual bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val);
bool extract(std::size_t pos, long& val) override;
/// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val);
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned long. Returns false if null was received.
#endif
virtual bool extract(std::size_t pos, bool& val);
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
virtual bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
virtual bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
virtual bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
virtual bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
virtual bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
virtual bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
virtual bool extract(std::size_t pos, DateTime& val);
bool extract(std::size_t pos, DateTime& val) override;
/// Extracts a DateTime. Returns false if null was received.
virtual bool extract(std::size_t pos, Date& val);
bool extract(std::size_t pos, Date& val) override;
/// Extracts a Date. Returns false if null was received.
virtual bool extract(std::size_t pos, Time& val);
bool extract(std::size_t pos, Time& val) override;
/// Extracts a Time. Returns false if null was received.
virtual bool extract(std::size_t pos, UUID& val);
bool extract(std::size_t pos, UUID& val) override;
/// Extracts a UUID. Returns false if null was received.
virtual bool extract(std::size_t pos, Any& val);
bool extract(std::size_t pos, Any& val) override;
/// Extracts an Any. Returns false if null was received.
virtual bool extract(std::size_t pos, Dynamic::Var& val);
bool extract(std::size_t pos, Dynamic::Var& val) override;
/// Extracts a Dynamic::Var. Returns false if null was received.
virtual bool isNull(std::size_t col, std::size_t row);
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts a nullable nullable Int8.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts a nullable nullable UInt8.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts a nullable nullable Int16.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts a nullable nullable UInt16.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts a nullable nullable Int32.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts a nullable nullable UInt32.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts a nullable nullable Int64.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts a nullable nullable UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a nullable long.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a nullable nullable unsigned long.
#endif
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a nullable boolean.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a nullable float.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a nullable double.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a nullable single character.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a nullable string.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a nullable UTF16String.
bool extract(std::size_t pos, Poco::Nullable<BLOB>& val) override;
/// Extracts a nullable BLOB.
bool extract(std::size_t pos, Poco::Nullable<CLOB>& val) override;
/// Extracts a nullable CLOB.
bool extract(std::size_t pos, Poco::Nullable<DateTime>& val) override;
/// Extracts a nullable DateTime.
bool extract(std::size_t pos, Poco::Nullable<Date>& val) override;
/// Extracts a nullable Date.
bool extract(std::size_t pos, Poco::Nullable<Time>& val) override;
/// Extracts a nullable Time.
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
/// Extracts a nullable UUID.
bool extract(std::size_t pos, Poco::Nullable<Any>& val) override;
/// Extracts a nullable nullable Any.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a nullable Var.
bool isNull(std::size_t col, std::size_t row) override;
/// Returns true if the value at [col,row] position is null.
virtual void reset();
void reset() override;
/// Resets any information internally cached by the extractor.
////////////
// Not implemented extract functions
////////////
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Extracts an Int8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Extracts an Int8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val);
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Extracts an Int8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Extracts an UInt8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Extracts an UInt8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Extracts an UInt8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Extracts an Int16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Extracts an Int16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val);
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Extracts an Int16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Extracts an UInt16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Extracts an UInt16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Extracts an UInt16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Extracts an Int32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Extracts an Int32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val);
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Extracts an Int32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Extracts an UInt32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Extracts an UInt32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Extracts an UInt32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Extracts an Int64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Extracts an Int64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val);
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Extracts an Int64 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Extracts an UInt64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Extracts an UInt64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, std::vector<long>& val);
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a long vector.
virtual bool extract(std::size_t pos, std::deque<long>& val);
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a long deque.
virtual bool extract(std::size_t pos, std::list<long>& val);
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a long list.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, std::vector<bool>& val);
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Extracts a boolean vector.
virtual bool extract(std::size_t pos, std::deque<bool>& val);
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Extracts a boolean deque.
virtual bool extract(std::size_t pos, std::list<bool>& val);
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Extracts a boolean list.
virtual bool extract(std::size_t pos, std::vector<float>& val);
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Extracts a float vector.
virtual bool extract(std::size_t pos, std::deque<float>& val);
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Extracts a float deque.
virtual bool extract(std::size_t pos, std::list<float>& val);
bool extract(std::size_t pos, std::list<float>& val) override;
/// Extracts a float list.
virtual bool extract(std::size_t pos, std::vector<double>& val);
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Extracts a double vector.
virtual bool extract(std::size_t pos, std::deque<double>& val);
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Extracts a double deque.
virtual bool extract(std::size_t pos, std::list<double>& val);
bool extract(std::size_t pos, std::list<double>& val) override;
/// Extracts a double list.
virtual bool extract(std::size_t pos, std::vector<char>& val);
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Extracts a character vector.
virtual bool extract(std::size_t pos, std::deque<char>& val);
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Extracts a character deque.
virtual bool extract(std::size_t pos, std::list<char>& val);
bool extract(std::size_t pos, std::list<char>& val) override;
/// Extracts a character list.
virtual bool extract(std::size_t pos, std::vector<std::string>& val);
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Extracts a string vector.
virtual bool extract(std::size_t pos, std::deque<std::string>& val);
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Extracts a string deque.
virtual bool extract(std::size_t pos, std::list<std::string>& val);
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Extracts a string list.
virtual bool extract(std::size_t pos, std::vector<BLOB>& val);
bool extract(std::size_t pos, std::vector<BLOB>& val) override;
/// Extracts a BLOB vector.
virtual bool extract(std::size_t pos, std::deque<BLOB>& val);
bool extract(std::size_t pos, std::deque<BLOB>& val) override;
/// Extracts a BLOB deque.
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
bool extract(std::size_t pos, std::list<BLOB>& val) override;
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, std::vector<CLOB>& val);
bool extract(std::size_t pos, std::vector<CLOB>& val) override;
/// Extracts a CLOB vector.
virtual bool extract(std::size_t pos, std::deque<CLOB>& val);
bool extract(std::size_t pos, std::deque<CLOB>& val) override;
/// Extracts a CLOB deque.
virtual bool extract(std::size_t pos, std::list<CLOB>& val);
bool extract(std::size_t pos, std::list<CLOB>& val) override;
/// Extracts a CLOB list.
virtual bool extract(std::size_t pos, std::vector<DateTime>& val);
bool extract(std::size_t pos, std::vector<DateTime>& val) override;
/// Extracts a DateTime vector.
virtual bool extract(std::size_t pos, std::deque<DateTime>& val);
bool extract(std::size_t pos, std::deque<DateTime>& val) override;
/// Extracts a DateTime deque.
virtual bool extract(std::size_t pos, std::list<DateTime>& val);
bool extract(std::size_t pos, std::list<DateTime>& val) override;
/// Extracts a DateTime list.
virtual bool extract(std::size_t pos, std::vector<Date>& val);
bool extract(std::size_t pos, std::vector<Date>& val) override;
/// Extracts a Date vector.
virtual bool extract(std::size_t pos, std::deque<Date>& val);
bool extract(std::size_t pos, std::deque<Date>& val) override;
/// Extracts a Date deque.
virtual bool extract(std::size_t pos, std::list<Date>& val);
bool extract(std::size_t pos, std::list<Date>& val) override;
/// Extracts a Date list.
virtual bool extract(std::size_t pos, std::vector<Time>& val);
bool extract(std::size_t pos, std::vector<Time>& val) override;
/// Extracts a Time vector.
virtual bool extract(std::size_t pos, std::deque<Time>& val);
bool extract(std::size_t pos, std::deque<Time>& val) override;
/// Extracts a Time deque.
virtual bool extract(std::size_t pos, std::list<Time>& val);
bool extract(std::size_t pos, std::list<Time>& val) override;
/// Extracts a Time list.
virtual bool extract(std::size_t pos, std::vector<Any>& val);
bool extract(std::size_t pos, std::vector<Any>& val) override;
/// Extracts an Any vector.
virtual bool extract(std::size_t pos, std::deque<Any>& val);
bool extract(std::size_t pos, std::deque<Any>& val) override;
/// Extracts an Any deque.
virtual bool extract(std::size_t pos, std::list<Any>& val);
bool extract(std::size_t pos, std::list<Any>& val) override;
/// Extracts an Any list.
virtual bool extract(std::size_t pos, std::vector<Dynamic::Var>& val);
bool extract(std::size_t pos, std::vector<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var vector.
virtual bool extract(std::size_t pos, std::deque<Dynamic::Var>& val);
bool extract(std::size_t pos, std::deque<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var deque.
virtual bool extract(std::size_t pos, std::list<Dynamic::Var>& val);
bool extract(std::size_t pos, std::list<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var list.
private:
@ -331,6 +416,15 @@ private:
Extractor& operator=(const Extractor&);
private:
template <typename T>
bool extractNullable(std::size_t pos, Poco::Nullable<T>& val)
{
typename Poco::Nullable<T>::Type v;
if (!extract(pos, v)) val.clear();
else val = std::move(v);
return true;
}
StatementExecutor& _stmt;
ResultMetadata& _metadata;
};

View File

@ -313,6 +313,154 @@ bool Extractor::extractJSON(std::size_t pos)
}
#endif
//////////////
// Nullable
//////////////
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
return extractNullable(pos, val);
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
return extractNullable(pos, val);
}
#endif
bool Extractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UTF16String>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<BLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<CLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<DateTime>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Date>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Time>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UUID>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Any>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
return extractNullable(pos, val);
}
//////////////
// Not implemented
//////////////
@ -479,6 +627,23 @@ bool Extractor::extract(std::size_t , std::list<long>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<unsigned long>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<unsigned long>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<unsigned long>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif

View File

@ -339,6 +339,27 @@ public:
void bind(std::size_t pos, const std::list<NullData>& val, Direction dir);
/// Binds a null list.
template <typename T>
void bind(std::size_t pos, const std::vector<Nullable<T>>& val, Direction dir)
/// Binds a nullable vector.
{
bindImplNullableContainer(pos, val, dir);
}
template <typename T>
void bind(std::size_t pos, const std::deque<Nullable<T>>& val, Direction dir)
/// Binds a nullable deque.
{
bindImplNullableContainer(pos, val, dir);
}
template <typename T>
void bind(std::size_t pos, const std::list<Nullable<T>>& val, Direction dir)
/// Binds a nullable list.
{
bindImplNullableContainer(pos, val, dir);
}
void setDataBinding(ParameterBinding binding);
/// Set data binding type.
@ -437,7 +458,7 @@ private:
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_BINARY,
Utility::sqlDataType(SQL_C_BINARY),
TypeInfo::sqlDataType<SQL_C_BINARY>(),
columnSize,
0,
pVal,
@ -615,7 +636,7 @@ private:
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_CHAR,
Utility::sqlDataType(SQL_C_CHAR),
TypeInfo::sqlDataType<SQL_C_CHAR>(),
getStringColSize(size),
0,
_charPtrs[pos],
@ -682,7 +703,7 @@ private:
(SQLUSMALLINT)pos + 1,
toODBCDirection(dir),
SQL_C_WCHAR,
Utility::sqlDataType(SQL_C_WCHAR),
TypeInfo::sqlDataType<SQL_C_WCHAR>(),
getStringColSize(size),
0,
_utf16CharPtrs[pos],
@ -752,7 +773,7 @@ private:
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_BINARY,
Utility::sqlDataType(SQL_C_BINARY),
TypeInfo::sqlDataType<SQL_C_BINARY>(),
(SQLUINTEGER) size,
0,
_charPtrs[pos],
@ -801,7 +822,7 @@ private:
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_DATE,
Utility::sqlDataType(SQL_C_TYPE_DATE),
TypeInfo::sqlDataType<SQL_C_TYPE_DATE>(),
colSize,
decDigits,
(SQLPOINTER) &(*_dateVecVec[pos])[0],
@ -849,7 +870,7 @@ private:
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_TIME,
Utility::sqlDataType(SQL_C_TYPE_TIME),
TypeInfo::sqlDataType<SQL_C_TYPE_TIME>(),
colSize,
decDigits,
(SQLPOINTER) &(*_timeVecVec[pos])[0],
@ -898,7 +919,7 @@ private:
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_TIMESTAMP,
Utility::sqlDataType(SQL_C_TYPE_TIMESTAMP),
TypeInfo::sqlDataType<SQL_C_TYPE_TIMESTAMP>(),
colSize,
decDigits,
(SQLPOINTER) &(*_dateTimeVecVec[pos])[0],
@ -919,6 +940,7 @@ private:
throw InvalidAccessException("ODBC::Binder::bindImplNullContainer():Container can only be bound immediately.");
std::size_t length = val.size();
poco_assert (length);
if (0 == length)
throw InvalidArgumentException("ODBC::Binder::bindImplNullContainer():Empty container not allowed.");
@ -928,18 +950,68 @@ private:
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1, 0);
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1);
_vecLengthIndicator[pos] = new LengthVec(length, SQL_NULL_DATA);
}
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits);
getColSizeAndPrecision(pos, SQL_C_CHAR, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_STINYINT,
Utility::sqlDataType(SQL_C_STINYINT),
SQL_C_CHAR,
TypeInfo::sqlDataType<SQL_C_CHAR>(),
colSize,
decDigits,
0,
0,
&(*_vecLengthIndicator[pos])[0])))
{
throw StatementException(_rStmt, "ODBC::Binder::bindImplNullContainer():SQLBindParameter()");
}
}
template<typename C>
void bindImplNullableContainer(std::size_t pos, const C& val, Direction dir)
{
if (isOutBound(dir) || !isInBound(dir))
throw NotImplementedException("ODBC::Binder::bindImplNullContainer():Null container parameter type can only be inbound.");
if (PB_IMMEDIATE != _paramBinding)
throw InvalidAccessException("ODBC::Binder::bindImplNullContainer():Container can only be bound immediately.");
std::size_t length = val.size();
poco_assert (length);
if (0 == length)
throw InvalidArgumentException("ODBC::Binder::bindImplNullContainer():Empty container not allowed.");
setParamSetSize(length);
if (_vecLengthIndicator.size() <= pos)
{
_vecLengthIndicator.resize(pos + 1, 0);
_vecLengthIndicator[pos] = new LengthVec(length, SQL_NULL_DATA);
auto valIt = val.begin(), valEnd = val.end();
auto lenIt = _vecLengthIndicator[pos]->begin(), lenEnd = _vecLengthIndicator[pos]->end();
for (; valIt != valEnd && lenIt != lenEnd; ++valIt, ++lenIt)
{
if (valIt->isNull()) *lenIt = SQL_NULL_DATA;
else *lenIt = Utility::sizeOf<C>();
}
}
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_C_CHAR, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
TypeInfo::sqlDataType<SQL_C_CHAR>(),
colSize,
decDigits,
0,

View File

@ -62,289 +62,372 @@ public:
~Extractor();
/// Destroys the Extractor.
bool extract(std::size_t pos, Poco::Int8& val);
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Extracts an Int8 vector.
bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Extracts an Int8 deque.
bool extract(std::size_t pos, std::list<Poco::Int8>& val);
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Extracts an Int8 list.
bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Extracts an UInt8 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Extracts an UInt8 deque.
bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Extracts an UInt8 list.
bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Extracts an Int16 vector.
bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Extracts an Int16 deque.
bool extract(std::size_t pos, std::list<Poco::Int16>& val);
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Extracts an Int16 list.
bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Extracts an UInt16 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Extracts an UInt16 deque.
bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Extracts an UInt16 list.
bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Extracts an Int32 vector.
bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Extracts an Int32 deque.
bool extract(std::size_t pos, std::list<Poco::Int32>& val);
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Extracts an Int32 list.
bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Extracts an UInt32 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Extracts an UInt32 deque.
bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Extracts an UInt32 list.
bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Extracts an Int64 vector.
bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Extracts an Int64 deque.
bool extract(std::size_t pos, std::list<Poco::Int64>& val);
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Extracts an Int64 list.
bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Extracts an UInt64 vector.
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Extracts an UInt64 deque.
bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val);
bool extract(std::size_t pos, long& val) override;
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val);
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned long.
bool extract(std::size_t pos, std::vector<long>& val);
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<long>& val);
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<long>& val);
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a long list.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts an unsigned long vector.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts an unsigned long deque.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts an unsigned long list.
#endif
bool extract(std::size_t pos, bool& val);
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
bool extract(std::size_t pos, std::vector<bool>& val);
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Extracts a boolean vector.
bool extract(std::size_t pos, std::deque<bool>& val);
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Extracts a boolean deque.
bool extract(std::size_t pos, std::list<bool>& val);
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Extracts a boolean list.
bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
bool extract(std::size_t pos, std::vector<float>& val);
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Extracts a float vector.
bool extract(std::size_t pos, std::deque<float>& val);
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Extracts a float deque.
bool extract(std::size_t pos, std::list<float>& val);
bool extract(std::size_t pos, std::list<float>& val) override;
/// Extracts a float list.
bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
bool extract(std::size_t pos, std::vector<double>& val);
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Extracts a double vector.
bool extract(std::size_t pos, std::deque<double>& val);
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Extracts a double deque.
bool extract(std::size_t pos, std::list<double>& val);
bool extract(std::size_t pos, std::list<double>& val) override;
/// Extracts a double list.
bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
bool extract(std::size_t pos, std::vector<char>& val);
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Extracts a single character vector.
bool extract(std::size_t pos, std::deque<char>& val);
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Extracts a single character deque.
bool extract(std::size_t pos, std::list<char>& val);
bool extract(std::size_t pos, std::list<char>& val) override;
/// Extracts a single character list.
bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
bool extract(std::size_t pos, std::vector<std::string>& val);
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Extracts a string vector.
bool extract(std::size_t pos, std::deque<std::string>& val);
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Extracts a string deque.
bool extract(std::size_t pos, std::list<std::string>& val);
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Extracts a string list.
/// Extracts a single character list.
bool extract(std::size_t pos, UTF16String& val);
bool extract(std::size_t pos, UTF16String& val) override;
/// Extracts a string.
bool extract(std::size_t pos, std::vector<UTF16String>& val);
bool extract(std::size_t pos, std::vector<UTF16String>& val) override;
/// Extracts a string vector.
bool extract(std::size_t pos, std::deque<UTF16String>& val);
bool extract(std::size_t pos, std::deque<UTF16String>& val) override;
/// Extracts a string deque.
bool extract(std::size_t pos, std::list<UTF16String>& val);
bool extract(std::size_t pos, std::list<UTF16String>& val) override;
/// Extracts a string list.
bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
bool extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val);
bool extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val) override;
/// Extracts a BLOB vector.
bool extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val);
bool extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val) override;
/// Extracts a BLOB deque.
bool extract(std::size_t pos, std::list<Poco::Data::BLOB>& val);
bool extract(std::size_t pos, std::list<Poco::Data::BLOB>& val) override;
/// Extracts a BLOB list.
bool extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val);
bool extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val) override;
/// Extracts a CLOB vector.
bool extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val);
bool extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val) override;
/// Extracts a CLOB deque.
bool extract(std::size_t pos, std::list<Poco::Data::CLOB>& val);
bool extract(std::size_t pos, std::list<Poco::Data::CLOB>& val) override;
/// Extracts a CLOB list.
bool extract(std::size_t pos, Poco::Data::Date& val);
bool extract(std::size_t pos, Poco::Data::Date& val) override;
/// Extracts a Date.
bool extract(std::size_t pos, std::vector<Poco::Data::Date>& val);
bool extract(std::size_t pos, std::vector<Poco::Data::Date>& val) override;
/// Extracts a Date vector.
bool extract(std::size_t pos, std::deque<Poco::Data::Date>& val);
bool extract(std::size_t pos, std::deque<Poco::Data::Date>& val) override;
/// Extracts a Date deque.
bool extract(std::size_t pos, std::list<Poco::Data::Date>& val);
bool extract(std::size_t pos, std::list<Poco::Data::Date>& val) override;
/// Extracts a Date list.
bool extract(std::size_t pos, Poco::Data::Time& val);
bool extract(std::size_t pos, Poco::Data::Time& val) override;
/// Extracts a Time.
bool extract(std::size_t pos, std::vector<Poco::Data::Time>& val);
bool extract(std::size_t pos, std::vector<Poco::Data::Time>& val) override;
/// Extracts a Time vector.
bool extract(std::size_t pos, std::deque<Poco::Data::Time>& val);
bool extract(std::size_t pos, std::deque<Poco::Data::Time>& val) override;
/// Extracts a Time deque.
bool extract(std::size_t pos, std::list<Poco::Data::Time>& val);
bool extract(std::size_t pos, std::list<Poco::Data::Time>& val) override;
/// Extracts a Time list.
bool extract(std::size_t pos, Poco::DateTime& val);
bool extract(std::size_t pos, Poco::DateTime& val) override;
/// Extracts a DateTime.
bool extract(std::size_t pos, std::vector<Poco::DateTime>& val);
bool extract(std::size_t pos, std::vector<Poco::DateTime>& val) override;
/// Extracts a DateTime vector.
bool extract(std::size_t pos, std::deque<Poco::DateTime>& val);
bool extract(std::size_t pos, std::deque<Poco::DateTime>& val) override;
/// Extracts a DateTime deque.
bool extract(std::size_t pos, std::list<Poco::DateTime>& val);
bool extract(std::size_t pos, std::list<Poco::DateTime>& val) override;
/// Extracts a DateTime list.
bool extract(std::size_t pos, Poco::UUID& val);
bool extract(std::size_t pos, Poco::UUID& val) override;
/// Extracts a UUID.
bool extract(std::size_t pos, Poco::Any& val);
bool extract(std::size_t pos, Poco::Any& val) override;
/// Extracts an Any.
bool extract(std::size_t pos, std::vector<Poco::Any>& val);
bool extract(std::size_t pos, std::vector<Poco::Any>& val) override;
/// Extracts an Any vector.
bool extract(std::size_t pos, std::deque<Poco::Any>& val);
bool extract(std::size_t pos, std::deque<Poco::Any>& val) override;
/// Extracts an Any deque.
bool extract(std::size_t pos, std::list<Poco::Any>& val);
bool extract(std::size_t pos, std::list<Poco::Any>& val) override;
/// Extracts an Any list.
bool extract(std::size_t pos, Poco::Dynamic::Var& val);
bool extract(std::size_t pos, Poco::Dynamic::Var& val) override;
/// Extracts a Dynamic::Var.
bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val);
bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var vector.
bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val);
bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var deque.
bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val);
bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var list.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts a Nullable Int8.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts a Nullable UInt8.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts a Nullable Int16.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts a Nullable UInt16.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts a Nullable Int32.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts a Nullable UInt32.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts a Nullable Int64.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts a Nullable UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a Nullable long.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a Nullable unsigned long.
#endif
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a Nullable bool.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a Nullable float.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a Nullable double.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a Nullable char.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a Nullable string.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a Nullable UTF16String.
bool extract(std::size_t pos, Poco::Nullable<BLOB>& val) override;
/// Extracts a Nullable BLOB.
bool extract(std::size_t pos, Poco::Nullable<CLOB>& val) override;
/// Extracts a Nullable CLOB.
bool extract(std::size_t pos, Poco::Nullable<DateTime>& val) override;
/// Extracts a Nullable DateTime.
bool extract(std::size_t pos, Poco::Nullable<Date>& val) override;
/// Extracts a Nullable Date.
bool extract(std::size_t pos, Poco::Nullable<Time>& val) override;
/// Extracts a Nullable Time.
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
/// Extracts a Nullable UUID.
bool extract(std::size_t pos, Poco::Nullable<Any>& val) override;
/// Extracts a Nullable Any.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a Nullable Var.
void setDataExtraction(Preparator::DataExtraction ext);
/// Set data extraction mode.
Preparator::DataExtraction getDataExtraction() const;
/// Returns data extraction mode.
bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW);
bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) override;
/// Returns true if the value at [col,row] is null.
void reset();
void reset() override;
/// Resets the internally cached length indicators.
private:
@ -618,6 +701,15 @@ private:
return ret;
}
template <typename T>
bool extractNullable(std::size_t pos, Poco::Nullable<T>& val)
{
typename Poco::Nullable<T>::Type v;
if (!extract(pos, v)) val.clear();
else val = std::move(v);
return true;
}
bool isNullLengthIndicator(SQLLEN val) const;
/// The reason for this utility wrapper are platforms where
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,

View File

@ -76,12 +76,112 @@ public:
~TypeInfo();
/// Destroys the TypeInfo.
int cDataType(int sqlDataType) const;
SQLSMALLINT cDataType(SQLSMALLINT sqlDataType) const;
/// Returns C data type corresponding to supplied SQL data type.
int sqlDataType(int cDataType) const;
template <SQLSMALLINT T>
static constexpr SQLSMALLINT cDataType()
/// Returns C data type corresponding to supplied SQL data type.
{
static_assert (
(T == SQL_CHAR ) ||
(T == SQL_CHAR ) ||
(T == SQL_VARCHAR ) ||
(T == SQL_LONGVARCHAR ) ||
(T == SQL_DECIMAL ) ||
(T == SQL_NUMERIC ) ||
(T == SQL_BIT ) ||
(T == SQL_TINYINT ) ||
(T == SQL_SMALLINT ) ||
(T == SQL_INTEGER ) ||
(T == SQL_BIGINT ) ||
(T == SQL_REAL ) ||
(T == SQL_FLOAT ) ||
(T == SQL_DOUBLE ) ||
(T == SQL_BINARY ) ||
(T == SQL_VARBINARY ) ||
(T == SQL_LONGVARBINARY ) ||
(T == SQL_TYPE_DATE ) ||
(T == SQL_TYPE_TIME ) ||
(T == SQL_TYPE_TIMESTAMP), "TypeInfo::cDataType(): Unknown SQL type."
);
if constexpr(T == SQL_CHAR ) return SQL_C_CHAR;
if constexpr(T == SQL_CHAR ) return SQL_C_CHAR;
if constexpr(T == SQL_VARCHAR ) return SQL_C_CHAR;
if constexpr(T == SQL_LONGVARCHAR ) return SQL_C_CHAR;
if constexpr(T == SQL_DECIMAL ) return SQL_C_DOUBLE;
if constexpr(T == SQL_NUMERIC ) return SQL_C_DOUBLE;
if constexpr(T == SQL_BIT ) return SQL_C_BIT;
if constexpr(T == SQL_TINYINT ) return SQL_C_STINYINT;
if constexpr(T == SQL_SMALLINT ) return SQL_C_SSHORT;
if constexpr(T == SQL_INTEGER ) return SQL_C_SLONG;
if constexpr(T == SQL_BIGINT ) return SQL_C_SBIGINT;
if constexpr(T == SQL_REAL ) return SQL_C_FLOAT;
if constexpr(T == SQL_FLOAT ) return SQL_C_DOUBLE;
if constexpr(T == SQL_DOUBLE ) return SQL_C_DOUBLE;
if constexpr(T == SQL_BINARY ) return SQL_C_BINARY;
if constexpr(T == SQL_VARBINARY ) return SQL_C_BINARY;
if constexpr(T == SQL_LONGVARBINARY ) return SQL_C_BINARY;
if constexpr(T == SQL_TYPE_DATE ) return SQL_C_TYPE_DATE;
if constexpr(T == SQL_TYPE_TIME ) return SQL_C_TYPE_TIME;
if constexpr(T == SQL_TYPE_TIMESTAMP) return SQL_C_TYPE_TIMESTAMP;
return 0;
}
SQLSMALLINT sqlDataType(SQLSMALLINT cDataType) const;
/// Returns SQL data type corresponding to supplied C data type.
template <SQLSMALLINT T>
static constexpr SQLSMALLINT sqlDataType()
/// Returns SQL data type corresponding to supplied C data type.
{
static_assert (
(T == SQL_C_CHAR ) ||
(T == SQL_C_WCHAR ) ||
(T == SQL_C_BIT ) ||
(T == SQL_C_TINYINT ) ||
(T == SQL_C_STINYINT ) ||
(T == SQL_C_UTINYINT ) ||
(T == SQL_C_SHORT ) ||
(T == SQL_C_SSHORT ) ||
(T == SQL_C_USHORT ) ||
(T == SQL_C_LONG ) ||
(T == SQL_C_SLONG ) ||
(T == SQL_C_ULONG ) ||
(T == SQL_C_SBIGINT ) ||
(T == SQL_C_UBIGINT ) ||
(T == SQL_C_FLOAT ) ||
(T == SQL_C_DOUBLE ) ||
(T == SQL_C_BINARY ) ||
(T == SQL_C_TYPE_DATE ) ||
(T == SQL_C_TYPE_TIME ) ||
(T == SQL_C_TYPE_TIMESTAMP), "TypeInfo::sqlDataType(): Unknown C type."
);
if constexpr(T == SQL_C_CHAR ) return SQL_VARCHAR;
if constexpr(T == SQL_C_WCHAR ) return SQL_WVARCHAR;
if constexpr(T == SQL_C_BIT ) return SQL_BIT;
if constexpr(T == SQL_C_TINYINT ) return SQL_TINYINT;
if constexpr(T == SQL_C_STINYINT ) return SQL_TINYINT;
if constexpr(T == SQL_C_UTINYINT ) return SQL_TINYINT;
if constexpr(T == SQL_C_SHORT ) return SQL_SMALLINT;
if constexpr(T == SQL_C_SSHORT ) return SQL_SMALLINT;
if constexpr(T == SQL_C_USHORT ) return SQL_SMALLINT;
if constexpr(T == SQL_C_LONG ) return SQL_INTEGER;
if constexpr(T == SQL_C_SLONG ) return SQL_INTEGER;
if constexpr(T == SQL_C_ULONG ) return SQL_INTEGER;
if constexpr(T == SQL_C_SBIGINT ) return SQL_BIGINT;
if constexpr(T == SQL_C_UBIGINT ) return SQL_BIGINT;
if constexpr(T == SQL_C_FLOAT ) return SQL_REAL;
if constexpr(T == SQL_C_DOUBLE ) return SQL_DOUBLE;
if constexpr(T == SQL_C_BINARY ) return SQL_LONGVARBINARY;
if constexpr(T == SQL_C_TYPE_DATE ) return SQL_TYPE_DATE;
if constexpr(T == SQL_C_TYPE_TIME ) return SQL_TYPE_TIME;
if constexpr(T == SQL_C_TYPE_TIMESTAMP) return SQL_TYPE_TIMESTAMP;
return 0;
}
void fillTypeInfo(const SQLHDBC* pHDBC);
/// Fills the data type info structure for the database.

View File

@ -171,6 +171,31 @@ public:
/// Returns the back end DBMS name.
/// On error, returns "unknown".
template <typename T>
static constexpr SQLINTEGER sizeOf()
/// Returns size of the data type.
{
static_assert (
(std::is_same_v<T, Date>) ||
(std::is_same_v<T, Time>) ||
(std::is_same_v<T, DateTime>) ||
(std::is_same_v<T, UUID>), "Utility::sizeOf(): Unsupported type"
);
if constexpr(std::is_same_v<T, Date >) return sizeof(SQL_DATE_STRUCT);
if constexpr(std::is_same_v<T, Time >) return sizeof(SQL_TIME_STRUCT);
if constexpr(std::is_same_v<T, DateTime>) return sizeof(SQL_TIMESTAMP_STRUCT);
if constexpr(std::is_same_v<T, UUID >) return 16;
return 0;
}
template <typename T>
static constexpr SQLINTEGER sizeOf(const T&)
/// Returns size of the data type.
{
return sizeOf<std::remove_const_t<std::remove_reference_t<T>>>();
}
private:
static const TypeInfo _dataTypes;
/// C <==> SQL data type mapping

View File

@ -165,7 +165,7 @@ void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
(SQLUSMALLINT)pos + 1,
toODBCDirection(dir),
SQL_C_CHAR,
Utility::sqlDataType(SQL_C_CHAR),
TypeInfo::sqlDataType<SQL_C_CHAR>(),
getStringColSize(colSize),
0,
pVal,
@ -218,7 +218,7 @@ void Binder::bind(std::size_t pos, const UTF16String& val, Direction dir)
(SQLUSMALLINT)pos + 1,
toODBCDirection(dir),
SQL_C_WCHAR,
Utility::sqlDataType(SQL_C_WCHAR),
TypeInfo::sqlDataType<SQL_C_WCHAR>(),
getStringColSize(colSize),
0,
pVal,
@ -232,7 +232,7 @@ void Binder::bind(std::size_t pos, const UTF16String& val, Direction dir)
void Binder::bind(std::size_t pos, const Date& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
SQLINTEGER size = Utility::sizeOf(val);
SQLLEN* pLenIn = new SQLLEN;
*pLenIn = size;
@ -251,7 +251,7 @@ void Binder::bind(std::size_t pos, const Date& val, Direction dir)
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_DATE,
Utility::sqlDataType(SQL_C_TYPE_DATE),
TypeInfo::sqlDataType<SQL_C_TYPE_DATE>(),
colSize,
decDigits,
(SQLPOINTER) pDS,
@ -265,7 +265,7 @@ void Binder::bind(std::size_t pos, const Date& val, Direction dir)
void Binder::bind(std::size_t pos, const Time& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIME_STRUCT);
SQLINTEGER size = Utility::sizeOf(val);
SQLLEN* pLenIn = new SQLLEN;
*pLenIn = size;
@ -284,7 +284,7 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_TIME,
Utility::sqlDataType(SQL_C_TYPE_TIME),
TypeInfo::sqlDataType<SQL_C_TYPE_TIME>(),
colSize,
decDigits,
(SQLPOINTER) pTS,
@ -298,7 +298,7 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::DateTime& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIMESTAMP_STRUCT);
SQLINTEGER size = Utility::sizeOf(val);
SQLLEN* pLenIn = new SQLLEN;
*pLenIn = size;
@ -317,7 +317,7 @@ void Binder::bind(std::size_t pos, const Poco::DateTime& val, Direction dir)
(SQLUSMALLINT) pos + 1,
toODBCDirection(dir),
SQL_C_TYPE_TIMESTAMP,
Utility::sqlDataType(SQL_C_TYPE_TIMESTAMP),
TypeInfo::sqlDataType<SQL_C_TYPE_TIMESTAMP>(),
colSize,
decDigits,
(SQLPOINTER) pTS,
@ -331,7 +331,7 @@ void Binder::bind(std::size_t pos, const Poco::DateTime& val, Direction dir)
void Binder::bind(std::size_t pos, const UUID& val, Direction dir)
{
SQLINTEGER size = (SQLINTEGER) 16;
SQLINTEGER size = Utility::sizeOf(val);
SQLLEN* pLenIn = new SQLLEN;
*pLenIn = size;
@ -375,13 +375,13 @@ void Binder::bind(std::size_t pos, const NullData& val, Direction dir)
SQLINTEGER colSize = 0;
SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits);
getColSizeAndPrecision(pos, SQL_C_CHAR, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
Utility::sqlDataType(SQL_C_CHAR),
TypeInfo::sqlDataType<SQL_C_CHAR>(),
colSize,
decDigits,
0,

View File

@ -108,6 +108,7 @@ bool Extractor::extractBoundImpl<Poco::Data::Date>(std::size_t pos, Poco::Data::
}
template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::size_t pos,
std::vector<Poco::Data::Date>& val)
@ -678,7 +679,34 @@ bool Extractor::extract(std::size_t pos, std::list<long>& val)
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
#endif
bool Extractor::extract(std::size_t pos, std::vector<unsigned long>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::deque<unsigned long>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
bool Extractor::extract(std::size_t pos, std::list<unsigned long>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
}
#endif // POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, double& val)
@ -1376,6 +1404,151 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val)
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
return extractNullable(pos, val);
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
return extractNullable(pos, val);
}
#endif
bool Extractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UTF16String>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<BLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<CLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<DateTime>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Date>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Time>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UUID>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Any>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
return extractNullable(pos, val);
}
bool Extractor::isNull(std::size_t col, std::size_t row)
{
if (Preparator::DE_MANUAL == _dataExtraction)

View File

@ -403,6 +403,7 @@ std::size_t ODBCStatementImpl::next()
if (nextRowReady())
{
Extractions& extracts = extractions();
poco_assert (extracts.size());
Extractions::iterator it = extracts.begin();
Extractions::iterator itEnd = extracts.end();
std::size_t prevCount = 0;

View File

@ -198,7 +198,7 @@ bool TypeInfo::tryGetInfo(SQLSMALLINT type, const std::string& param, Dynamic::V
}
int TypeInfo::cDataType(int sqlDataType) const
SQLSMALLINT TypeInfo::cDataType(SQLSMALLINT sqlDataType) const
{
DataTypeMap::const_iterator it = _cDataTypes.find(sqlDataType);
@ -209,7 +209,7 @@ int TypeInfo::cDataType(int sqlDataType) const
}
int TypeInfo::sqlDataType(int cDataType) const
SQLSMALLINT TypeInfo::sqlDataType(SQLSMALLINT cDataType) const
{
DataTypeMap::const_iterator it = _sqlDataTypes.find(cDataType);

View File

@ -153,21 +153,24 @@ void Utility::dateTimeSync(SQL_TIMESTAMP_STRUCT& ts, const Poco::DateTime& dt)
ts.second = dt.second();
// Fraction support is limited to milliseconds due to MS SQL Server limitation
// see http://support.microsoft.com/kb/263872
ts.fraction = (dt.millisecond() * 1000000);// + (dt.microsecond() * 1000);
ts.fraction = (dt.millisecond() * 1000000);
}
std::string Utility::dbmsName(const ConnectionHandle& db)
{
std::string ret = "unknown"s;
const SQLSMALLINT bufSize = 1024;
SQLCHAR dbmsName[bufSize] = {0};
SQLSMALLINT retSize = 0;
SQLRETURN rc = Poco::Data::ODBC::SQLGetInfo(const_cast<SQLHDBC>(db.handle()), SQL_DBMS_NAME, dbmsName, bufSize, &retSize);
if (!isError(rc))
{
return std::string(reinterpret_cast<char*>(dbmsName), retSize);
ret.assign(reinterpret_cast<char*>(dbmsName), retSize);
// API returns string longer than effective length
ret.erase(ret.find_last_not_of('\0') + 1, std::string::npos);
}
return "unknown"s;
return ret;
}

View File

@ -967,6 +967,7 @@ CppUnit::Test* ODBCOracleTest::suite()
CppUnit_addTest(pSuite, ODBCOracleTest, testLimitPrepare);
CppUnit_addTest(pSuite, ODBCOracleTest, testLimitZero);
CppUnit_addTest(pSuite, ODBCOracleTest, testPrepare);
CppUnit_addTest(pSuite, ODBCOracleTest, testNullBulk);
CppUnit_addTest(pSuite, ODBCOracleTest, testBulk);
CppUnit_addTest(pSuite, ODBCOracleTest, testBulkPerformance);
CppUnit_addTest(pSuite, ODBCOracleTest, testSetSimple);

View File

@ -51,6 +51,7 @@ using Poco::DateTime;
// FreeTDS version selection guide: http://www.freetds.org/userguide/choosingtdsprotocol.htm
// (see #define FREE_TDS_VERSION below)
#if !defined(FORCE_FREE_TDS)
#ifdef POCO_ODBC_USE_SQL_NATIVE
#define MS_SQL_SERVER_ODBC_DRIVER "SQL Server Native Client 10.0"
@ -61,10 +62,8 @@ using Poco::DateTime;
#else
#define MS_SQL_SERVER_ODBC_DRIVER "FreeTDS"
#define FREE_TDS_VERSION "7.4"
#if defined(POCO_OS_FAMILY_WINDOWS)
#pragma message ("Using " MS_SQL_SERVER_ODBC_DRIVER " driver, version " FREE_TDS_VERSION)
#endif
#endif
#if POCO_DATA_SQL_SERVER_BIG_STRINGS
#pragma message ("MS SQLServer ODBC big string capability ENABLED")
@ -399,6 +398,26 @@ void ODBCSQLServerTest::testNull()
}
void ODBCSQLServerTest::testNullBulk()
{
try
{
if (!_pSession) fail ("Test not available.");
_pSession->setFeature("autoBind", true);
_pSession->setFeature("autoExtract", true);
recreatePersonBLOBTable();
_pExecutor->nullBulk("CONVERT(VARBINARY(30),?)");
}
catch(Poco::Exception& ex)
{
std::cout << ex.displayText() << std::endl;
}
}
void ODBCSQLServerTest::testBulk()
{
if (!_pSession) fail ("Test not available.");
@ -1086,6 +1105,7 @@ CppUnit::Test* ODBCSQLServerTest::suite()
CppUnit_addTest(pSuite, ODBCSQLServerTest, testLimitZero);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testPrepare);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testBulk);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testNullBulk);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testBulkPerformance);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSetSimple);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSetComplex);

View File

@ -51,6 +51,7 @@ public:
void testBigStringVector();
void testBigBatch();
void testNull() override;
void testNullBulk() override;
void testBulk() override;
void testStoredProcedure() override;

View File

@ -485,6 +485,18 @@ void ODBCTest::testPrepare()
}
void ODBCTest::testNullBulk()
{
if (!_pSession) fail ("Test not available.");
_pSession->setFeature("autoBind", true);
_pSession->setFeature("autoExtract", true);
recreatePersonBLOBTable();
_pExecutor->nullBulk();
}
void ODBCTest::testBulk()
{
if (!_pSession) fail ("Test not available.");

View File

@ -83,6 +83,7 @@ public:
virtual void testLimitPrepare();
virtual void testLimitZero();
virtual void testPrepare();
virtual void testNullBulk();
virtual void testBulk();
virtual void testBulkPerformance();

View File

@ -24,19 +24,6 @@ CppUnit::Test* ODBCTestSuite::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ODBCTestSuite");
// WARNING!
// On Win XP Pro, the PostgreSQL connection fails if attempted after DB2 w/ following error:
//
// sqlState="IM003"
// message="Specified driver could not be loaded due to system error 127 (PostgreSQL ANSI)."
// nativeError=160
// System error 127 is "The specified procedure could not be found."
// This problem does not manifest with Mammoth ODBCng PostgreSQL driver.
//
// Oracle tests do not exit cleanly if Oracle driver is loaded after DB2.
//
// For the time being, the workaround is to connect to DB2 after connecting to PostgreSQL and Oracle.
addTest(pSuite, ODBCOracleTest::suite());
addTest(pSuite, ODBCSQLServerTest::suite());
addTest(pSuite, ODBCMySQLTest::suite());

View File

@ -158,6 +158,8 @@ public:
void limitZero();
void prepare();
void nullBulk(const std::string& blobPlaceholder="?");
template <typename C1, typename C2, typename C3, typename C4, typename C5, typename C6>
void doBulkWithBool(Poco::UInt32 size, const std::string& blobPlaceholder="?")
{
@ -719,6 +721,12 @@ inline void SQLExecutor::prepare()
}
inline void SQLExecutor::nullBulk(const std::string& blobPlaceholder)
{
_dataExecutor.nullBulk(blobPlaceholder);
}
inline void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
{
_dataExecutor.doBulkPerformance(size);

View File

@ -47,276 +47,359 @@ public:
virtual ~BinaryExtractor();
/// Destroys the Extractor.
virtual bool extract(std::size_t pos, Poco::Int8& val);
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
virtual bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
virtual bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
virtual bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
virtual bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
virtual bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
virtual bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
virtual bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val);
bool extract(std::size_t pos, long& val) override;
/// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val);
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned long. Returns false if null was received.
#endif
virtual bool extract(std::size_t pos, bool& val);
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
virtual bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
virtual bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
virtual bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
virtual bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
virtual bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
virtual bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
virtual bool extract(std::size_t pos, DateTime& val);
bool extract(std::size_t pos, DateTime& val) override;
/// Extracts a DateTime. Returns false if null was received.
virtual bool extract(std::size_t pos, Date& val);
bool extract(std::size_t pos, Date& val) override;
/// Extracts a Date. Returns false if null was received.
virtual bool extract(std::size_t pos, Time& val);
bool extract(std::size_t pos, Time& val) override;
/// Extracts a Time. Returns false if null was received.
virtual bool extract(std::size_t pos, UUID& val);
bool extract(std::size_t pos, UUID& val) override;
/// Extracts a UUID. Returns false if null was received.
virtual bool extract(std::size_t pos, Any& val);
bool extract(std::size_t pos, Any& val) override;
/// Extracts an Any. Returns false if null was received.
virtual bool extract(std::size_t pos, Dynamic::Var& val);
bool extract(std::size_t pos, Dynamic::Var& val) override;
/// Extracts a Dynamic::Var. Returns false if null was received.
virtual bool isNull(std::size_t col, std::size_t row);
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts a nullable nullable Int8.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts a nullable nullable UInt8.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts a nullable nullable Int16.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts a nullable nullable UInt16.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts a nullable nullable Int32.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts a nullable nullable UInt32.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts a nullable nullable Int64.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts a nullable nullable UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a nullable long.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a nullable nullable unsigned long.
#endif
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a nullable boolean.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a nullable float.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a nullable double.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a nullable single character.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a nullable string.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a nullable UTF16String.
bool extract(std::size_t pos, Poco::Nullable<BLOB>& val) override;
/// Extracts a nullable BLOB.
bool extract(std::size_t pos, Poco::Nullable<CLOB>& val) override;
/// Extracts a nullable CLOB.
bool extract(std::size_t pos, Poco::Nullable<DateTime>& val) override;
/// Extracts a nullable DateTime.
bool extract(std::size_t pos, Poco::Nullable<Date>& val) override;
/// Extracts a nullable Date.
bool extract(std::size_t pos, Poco::Nullable<Time>& val) override;
/// Extracts a nullable Time.
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
/// Extracts a nullable UUID.
bool extract(std::size_t pos, Poco::Nullable<Any>& val) override;
/// Extracts a nullable nullable Any.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a nullable Var.
bool isNull(std::size_t col, std::size_t row) override;
/// Returns true if the value at [col,row] position is null.
virtual void reset();
void reset() override;
/// Resets any information internally cached by the extractor.
////////////
// Not implemented extract functions
////////////
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Extracts an Int8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Extracts an Int8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val);
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Extracts an Int8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Extracts an UInt8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Extracts an UInt8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Extracts an UInt8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Extracts an Int16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Extracts an Int16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val);
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Extracts an Int16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Extracts an UInt16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Extracts an UInt16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Extracts an UInt16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Extracts an Int32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Extracts an Int32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val);
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Extracts an Int32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Extracts an UInt32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Extracts an UInt32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Extracts an UInt32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Extracts an Int64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Extracts an Int64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val);
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Extracts an Int64 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Extracts an UInt64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Extracts an UInt64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, std::vector<long>& val);
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a long vector.
virtual bool extract(std::size_t pos, std::deque<long>& val);
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a long deque.
virtual bool extract(std::size_t pos, std::list<long>& val);
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a long list.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, std::vector<bool>& val);
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Extracts a boolean vector.
virtual bool extract(std::size_t pos, std::deque<bool>& val);
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Extracts a boolean deque.
virtual bool extract(std::size_t pos, std::list<bool>& val);
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Extracts a boolean list.
virtual bool extract(std::size_t pos, std::vector<float>& val);
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Extracts a float vector.
virtual bool extract(std::size_t pos, std::deque<float>& val);
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Extracts a float deque.
virtual bool extract(std::size_t pos, std::list<float>& val);
bool extract(std::size_t pos, std::list<float>& val) override;
/// Extracts a float list.
virtual bool extract(std::size_t pos, std::vector<double>& val);
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Extracts a double vector.
virtual bool extract(std::size_t pos, std::deque<double>& val);
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Extracts a double deque.
virtual bool extract(std::size_t pos, std::list<double>& val);
bool extract(std::size_t pos, std::list<double>& val) override;
/// Extracts a double list.
virtual bool extract(std::size_t pos, std::vector<char>& val);
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Extracts a character vector.
virtual bool extract(std::size_t pos, std::deque<char>& val);
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Extracts a character deque.
virtual bool extract(std::size_t pos, std::list<char>& val);
bool extract(std::size_t pos, std::list<char>& val) override;
/// Extracts a character list.
virtual bool extract(std::size_t pos, std::vector<std::string>& val);
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Extracts a string vector.
virtual bool extract(std::size_t pos, std::deque<std::string>& val);
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Extracts a string deque.
virtual bool extract(std::size_t pos, std::list<std::string>& val);
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Extracts a string list.
virtual bool extract(std::size_t pos, std::vector<BLOB>& val);
bool extract(std::size_t pos, std::vector<BLOB>& val) override;
/// Extracts a BLOB vector.
virtual bool extract(std::size_t pos, std::deque<BLOB>& val);
bool extract(std::size_t pos, std::deque<BLOB>& val) override;
/// Extracts a BLOB deque.
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
bool extract(std::size_t pos, std::list<BLOB>& val) override;
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, std::vector<CLOB>& val);
bool extract(std::size_t pos, std::vector<CLOB>& val) override;
/// Extracts a CLOB vector.
virtual bool extract(std::size_t pos, std::deque<CLOB>& val);
bool extract(std::size_t pos, std::deque<CLOB>& val) override;
/// Extracts a CLOB deque.
virtual bool extract(std::size_t pos, std::list<CLOB>& val);
bool extract(std::size_t pos, std::list<CLOB>& val) override;
/// Extracts a CLOB list.
virtual bool extract(std::size_t pos, std::vector<DateTime>& val);
bool extract(std::size_t pos, std::vector<DateTime>& val) override;
/// Extracts a DateTime vector.
virtual bool extract(std::size_t pos, std::deque<DateTime>& val);
bool extract(std::size_t pos, std::deque<DateTime>& val) override;
/// Extracts a DateTime deque.
virtual bool extract(std::size_t pos, std::list<DateTime>& val);
bool extract(std::size_t pos, std::list<DateTime>& val) override;
/// Extracts a DateTime list.
virtual bool extract(std::size_t pos, std::vector<Date>& val);
bool extract(std::size_t pos, std::vector<Date>& val) override;
/// Extracts a Date vector.
virtual bool extract(std::size_t pos, std::deque<Date>& val);
bool extract(std::size_t pos, std::deque<Date>& val) override;
/// Extracts a Date deque.
virtual bool extract(std::size_t pos, std::list<Date>& val);
bool extract(std::size_t pos, std::list<Date>& val) override;
/// Extracts a Date list.
virtual bool extract(std::size_t pos, std::vector<Time>& val);
bool extract(std::size_t pos, std::vector<Time>& val) override;
/// Extracts a Time vector.
virtual bool extract(std::size_t pos, std::deque<Time>& val);
bool extract(std::size_t pos, std::deque<Time>& val) override;
/// Extracts a Time deque.
virtual bool extract(std::size_t pos, std::list<Time>& val);
bool extract(std::size_t pos, std::list<Time>& val) override;
/// Extracts a Time list.
virtual bool extract(std::size_t pos, std::vector<Any>& val);
bool extract(std::size_t pos, std::vector<Any>& val) override;
/// Extracts an Any vector.
virtual bool extract(std::size_t pos, std::deque<Any>& val);
bool extract(std::size_t pos, std::deque<Any>& val) override;
/// Extracts an Any deque.
virtual bool extract(std::size_t pos, std::list<Any>& val);
bool extract(std::size_t pos, std::list<Any>& val) override;
/// Extracts an Any list.
virtual bool extract(std::size_t pos, std::vector<Dynamic::Var>& val);
bool extract(std::size_t pos, std::vector<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var vector.
virtual bool extract(std::size_t pos, std::deque<Dynamic::Var>& val);
bool extract(std::size_t pos, std::deque<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var deque.
virtual bool extract(std::size_t pos, std::list<Dynamic::Var>& val);
bool extract(std::size_t pos, std::list<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var list.
private:
@ -327,6 +410,15 @@ private:
BinaryExtractor& operator = (const BinaryExtractor&);
private:
template <typename T>
bool extractNullable(std::size_t pos, Poco::Nullable<T>& val)
{
typename Poco::Nullable<T>::Type v;
if (!extract(pos, v)) val.clear();
else val = std::move(v);
return true;
}
StatementExecutor& _statementExecutor;
};

View File

@ -44,279 +44,362 @@ public:
Extractor(StatementExecutor& st);
/// Creates the Extractor.
virtual ~Extractor();
~Extractor() override;
/// Destroys the Extractor.
virtual bool extract(std::size_t pos, Poco::Int8& val);
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
virtual bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
virtual bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
virtual bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
virtual bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
virtual bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
virtual bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
virtual bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val);
bool extract(std::size_t pos, long& val) override;
/// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val);
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned long. Returns false if null was received.
#endif
virtual bool extract(std::size_t pos, bool& val);
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
virtual bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
virtual bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
virtual bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
virtual bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
virtual bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
virtual bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
virtual bool extract(std::size_t pos, DateTime& val);
bool extract(std::size_t pos, DateTime& val) override;
/// Extracts a DateTime. Returns false if null was received.
virtual bool extract(std::size_t pos, Date& val);
bool extract(std::size_t pos, Date& val) override;
/// Extracts a Date. Returns false if null was received.
virtual bool extract(std::size_t pos, Time& val);
bool extract(std::size_t pos, Time& val) override;
/// Extracts a Time. Returns false if null was received.
virtual bool extract(std::size_t pos, UUID& val);
bool extract(std::size_t pos, UUID& val) override;
/// Extracts a UUID. Returns false if null was received.
virtual bool extract(std::size_t pos, Any& val);
bool extract(std::size_t pos, Any& val) override;
/// Extracts an Any. Returns false if null was received.
virtual bool extract(std::size_t pos, Dynamic::Var& val);
bool extract(std::size_t pos, Dynamic::Var& val) override;
/// Extracts a Dynamic::Var. Returns false if null was received.
virtual bool isNull(std::size_t col, std::size_t row);
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts a nullable nullable Int8.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts a nullable nullable UInt8.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts a nullable nullable Int16.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts a nullable nullable UInt16.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts a nullable nullable Int32.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts a nullable nullable UInt32.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts a nullable nullable Int64.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts a nullable nullable UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a nullable long.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a nullable nullable unsigned long.
#endif
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a nullable boolean.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a nullable float.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a nullable double.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a nullable single character.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a nullable string.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a nullable UTF16String.
bool extract(std::size_t pos, Poco::Nullable<BLOB>& val) override;
/// Extracts a nullable BLOB.
bool extract(std::size_t pos, Poco::Nullable<CLOB>& val) override;
/// Extracts a nullable CLOB.
bool extract(std::size_t pos, Poco::Nullable<DateTime>& val) override;
/// Extracts a nullable DateTime.
bool extract(std::size_t pos, Poco::Nullable<Date>& val) override;
/// Extracts a nullable Date.
bool extract(std::size_t pos, Poco::Nullable<Time>& val) override;
/// Extracts a nullable Time.
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
/// Extracts a nullable UUID.
bool extract(std::size_t pos, Poco::Nullable<Any>& val) override;
/// Extracts a nullable nullable Any.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a nullable Var.
bool isNull(std::size_t col, std::size_t row) override;
/// Returns true if the value at [col,row] position is null.
virtual void reset();
void reset() override;
/// Resets any information internally cached by the extractor.
////////////
// Not implemented extract functions
////////////
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Extracts an Int8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Extracts an Int8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val);
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Extracts an Int8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Extracts an UInt8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Extracts an UInt8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Extracts an UInt8 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Extracts an Int16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Extracts an Int16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val);
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Extracts an Int16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Extracts an UInt16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Extracts an UInt16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Extracts an UInt16 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val);
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Extracts an Int32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Extracts an Int32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val);
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Extracts an Int32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Extracts an UInt32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Extracts an UInt32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Extracts an UInt32 list.
virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val);
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Extracts an Int64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Extracts an Int64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val);
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Extracts an Int64 list.
virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val);
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Extracts an UInt64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Extracts an UInt64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, std::vector<long>& val);
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a long vector.
virtual bool extract(std::size_t pos, std::deque<long>& val);
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a long deque.
virtual bool extract(std::size_t pos, std::list<long>& val);
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a long list.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, std::vector<bool>& val);
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Extracts a boolean vector.
virtual bool extract(std::size_t pos, std::deque<bool>& val);
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Extracts a boolean deque.
virtual bool extract(std::size_t pos, std::list<bool>& val);
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Extracts a boolean list.
virtual bool extract(std::size_t pos, std::vector<float>& val);
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Extracts a float vector.
virtual bool extract(std::size_t pos, std::deque<float>& val);
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Extracts a float deque.
virtual bool extract(std::size_t pos, std::list<float>& val);
bool extract(std::size_t pos, std::list<float>& val) override;
/// Extracts a float list.
virtual bool extract(std::size_t pos, std::vector<double>& val);
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Extracts a double vector.
virtual bool extract(std::size_t pos, std::deque<double>& val);
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Extracts a double deque.
virtual bool extract(std::size_t pos, std::list<double>& val);
bool extract(std::size_t pos, std::list<double>& val) override;
/// Extracts a double list.
virtual bool extract(std::size_t pos, std::vector<char>& val);
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Extracts a character vector.
virtual bool extract(std::size_t pos, std::deque<char>& val);
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Extracts a character deque.
virtual bool extract(std::size_t pos, std::list<char>& val);
bool extract(std::size_t pos, std::list<char>& val) override;
/// Extracts a character list.
virtual bool extract(std::size_t pos, std::vector<std::string>& val);
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Extracts a string vector.
virtual bool extract(std::size_t pos, std::deque<std::string>& val);
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Extracts a string deque.
virtual bool extract(std::size_t pos, std::list<std::string>& val);
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Extracts a string list.
virtual bool extract(std::size_t pos, std::vector<BLOB>& val);
bool extract(std::size_t pos, std::vector<BLOB>& val) override;
/// Extracts a BLOB vector.
virtual bool extract(std::size_t pos, std::deque<BLOB>& val);
bool extract(std::size_t pos, std::deque<BLOB>& val) override;
/// Extracts a BLOB deque.
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
bool extract(std::size_t pos, std::list<BLOB>& val) override;
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, std::vector<CLOB>& val);
bool extract(std::size_t pos, std::vector<CLOB>& val) override;
/// Extracts a CLOB vector.
virtual bool extract(std::size_t pos, std::deque<CLOB>& val);
bool extract(std::size_t pos, std::deque<CLOB>& val) override;
/// Extracts a CLOB deque.
virtual bool extract(std::size_t pos, std::list<CLOB>& val);
bool extract(std::size_t pos, std::list<CLOB>& val) override;
/// Extracts a CLOB list.
virtual bool extract(std::size_t pos, std::vector<DateTime>& val);
bool extract(std::size_t pos, std::vector<DateTime>& val) override;
/// Extracts a DateTime vector.
virtual bool extract(std::size_t pos, std::deque<DateTime>& val);
bool extract(std::size_t pos, std::deque<DateTime>& val) override;
/// Extracts a DateTime deque.
virtual bool extract(std::size_t pos, std::list<DateTime>& val);
bool extract(std::size_t pos, std::list<DateTime>& val) override;
/// Extracts a DateTime list.
virtual bool extract(std::size_t pos, std::vector<Date>& val);
bool extract(std::size_t pos, std::vector<Date>& val) override;
/// Extracts a Date vector.
virtual bool extract(std::size_t pos, std::deque<Date>& val);
bool extract(std::size_t pos, std::deque<Date>& val) override;
/// Extracts a Date deque.
virtual bool extract(std::size_t pos, std::list<Date>& val);
bool extract(std::size_t pos, std::list<Date>& val) override;
/// Extracts a Date list.
virtual bool extract(std::size_t pos, std::vector<Time>& val);
bool extract(std::size_t pos, std::vector<Time>& val) override;
/// Extracts a Time vector.
virtual bool extract(std::size_t pos, std::deque<Time>& val);
bool extract(std::size_t pos, std::deque<Time>& val) override;
/// Extracts a Time deque.
virtual bool extract(std::size_t pos, std::list<Time>& val);
bool extract(std::size_t pos, std::list<Time>& val) override;
/// Extracts a Time list.
virtual bool extract(std::size_t pos, std::vector<Any>& val);
bool extract(std::size_t pos, std::vector<Any>& val) override;
/// Extracts an Any vector.
virtual bool extract(std::size_t pos, std::deque<Any>& val);
bool extract(std::size_t pos, std::deque<Any>& val) override;
/// Extracts an Any deque.
virtual bool extract(std::size_t pos, std::list<Any>& val);
bool extract(std::size_t pos, std::list<Any>& val) override;
/// Extracts an Any list.
virtual bool extract(std::size_t pos, std::vector<Dynamic::Var>& val);
bool extract(std::size_t pos, std::vector<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var vector.
virtual bool extract(std::size_t pos, std::deque<Dynamic::Var>& val);
bool extract(std::size_t pos, std::deque<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var deque.
virtual bool extract(std::size_t pos, std::list<Dynamic::Var>& val);
bool extract(std::size_t pos, std::list<Dynamic::Var>& val) override;
/// Extracts a Dynamic::Var list.
private:
@ -343,6 +426,15 @@ private:
bool extractToDynamic(std::size_t pos, Dynamic::Var& val);
template <typename T>
bool extractNullable(std::size_t pos, Poco::Nullable<T>& val)
{
typename Poco::Nullable<T>::Type v;
if (!extract(pos, v)) val.clear();
else val = std::move(v);
return true;
}
// Prevent VC8 warning "operator= could not be generated"
Extractor& operator = (const Extractor&);

View File

@ -652,6 +652,154 @@ bool BinaryExtractor::extract(std::size_t pos, Dynamic::Var& val)
return readVar(outputParameter, val);
}
//////////////
// Nullable
//////////////
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
return extractNullable(pos, val);
}
#ifndef POCO_INT64_IS_LONG
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
return extractNullable(pos, val);
}
#endif
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<UTF16String>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<BLOB>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<CLOB>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<DateTime>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Date>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Time>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<UUID>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Any>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
return extractNullable(pos, val);
}
bool BinaryExtractor::isNull(std::size_t col, std::size_t /*row*/)
{
@ -849,6 +997,23 @@ bool BinaryExtractor::extract(std::size_t, std::list<long>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool BinaryExtractor::extract(std::size_t, std::vector<unsigned long>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool BinaryExtractor::extract(std::size_t, std::deque<unsigned long>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool BinaryExtractor::extract(std::size_t, std::list<unsigned long>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif

View File

@ -27,7 +27,7 @@ namespace Data {
namespace PostgreSQL {
Extractor::Extractor(StatementExecutor& st /*, ResultMetadata& md */):
Extractor::Extractor(StatementExecutor& st):
_statementExecutor(st)
{
}
@ -539,6 +539,154 @@ bool Extractor::extractToDynamic(std::size_t pos, Dynamic::Var& val)
return success;
}
//////////////
// Nullable
//////////////
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
return extractNullable(pos, val);
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
return extractNullable(pos, val);
}
#endif
bool Extractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UTF16String>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<BLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<CLOB>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<DateTime>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Date>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Time>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<UUID>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Any>& val)
{
return extractNullable(pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
return extractNullable(pos, val);
}
//////////////
// Not implemented
@ -706,6 +854,23 @@ bool Extractor::extract(std::size_t, std::list<long>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t, std::vector<unsigned long>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t, std::deque<unsigned long>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t, std::list<unsigned long>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif

View File

@ -151,18 +151,11 @@ void PostgreSQLTest::testFailedConnect()
try
{
std::cout << "Attempting to Connect to [" << dbConnString << "] with invalid credentials: " << std::endl;
Session session(PostgreSQL::Connector::KEY, dbConnString);
fail ("must fail");
}
catch (ConnectionFailedException& ex)
{
std::cout << ex.displayText() << std::endl;
}
catch (ConnectionException& ex)
{
std::cout << ex.displayText() << std::endl;
failmsg ("must fail");
}
catch (ConnectionFailedException& ex) {}
catch (ConnectionException& ex) {}
}

View File

@ -28,6 +28,9 @@
#include "Poco/Data/Time.h"
#include "Poco/Data/Date.h"
#include "Poco/Data/Time.h"
#include "Poco/Nullable.h"
#include "Poco/UUID.h"
#include "Poco/UTFString.h"
#include "Poco/Any.h"
#include "Poco/Dynamic/Var.h"
#include "sqlite3.h"
@ -45,7 +48,7 @@ class SQLite_API Extractor: public Poco::Data::AbstractExtractor
/// If NULL is received, the incoming val value is not changed and false is returned
{
public:
typedef std::vector<std::pair<bool, bool> > NullIndVec;
using NullIndVec = std::vector<std::pair<bool, bool> >;
/// Type for null indicators container.
Extractor(sqlite3_stmt* pStmt);
@ -54,78 +57,373 @@ public:
~Extractor();
/// Destroys the Extractor.
bool extract(std::size_t pos, Poco::Int8& val);
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val);
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long.
#endif
bool extract(std::size_t pos, bool& val);
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, UTF16String& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
bool extract(std::size_t pos, Poco::Data::Date& val);
bool extract(std::size_t pos, Poco::Data::Date& val) override;
/// Extracts a Date.
bool extract(std::size_t pos, Poco::Data::Time& val);
bool extract(std::size_t pos, Poco::Data::Time& val) override;
/// Extracts a Time.
bool extract(std::size_t pos, Poco::DateTime& val);
bool extract(std::size_t pos, Poco::DateTime& val) override;
/// Extracts a DateTime.
bool extract(std::size_t pos, Poco::UUID& val);
/// Extracts a Time.
bool extract(std::size_t pos, Poco::UUID& val) override;
/// Extracts a UUID.
bool extract(std::size_t pos, Poco::Any& val);
bool extract(std::size_t pos, Poco::Any& val) override;
/// Extracts an Any.
bool extract(std::size_t pos, Poco::Dynamic::Var& val);
bool extract(std::size_t pos, Poco::Dynamic::Var& val) override;
/// Extracts a Dynamic::Var.
bool isNull(std::size_t pos, std::size_t row = POCO_DATA_INVALID_ROW);
// Nullable extraction
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts an Nullable<Int8>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts an Nullable<UInt8>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts an Nullable<Int16>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts an Nullable<UInt16>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts an Nullable<Int32>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts an Nullable<UInt32>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts an Nullable<Int64>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts an Nullable<UInt64>.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val) override;
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned long.
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a long vector.
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a long deque.
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a long list.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts an unsigned long vector.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts an unsigned long deque.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts an unsigned long list.
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a Nullable<long>.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a Nullable<unsigned long>.
#endif
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a Nullable<bool>.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a Nullable<float>.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a Nullable<double>.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a single Nullable character.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a Nullable<string>.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a Nullable<UTF16String>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Data::BLOB>& val) override;
/// Extracts a Nullable<BLOB>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Data::CLOB>& val) override;
/// Extracts a Nullable<BLOB>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Data::Date>& val) override;
/// Extracts a Nullable<Date>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Data::Time>& val) override;
/// Extracts a :Nullable<Time>.
bool extract(std::size_t pos, Poco::Nullable<Poco::DateTime>& val) override;
/// Extracts Nullable<DateTime>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UUID>& val) override;
/// Extracts a Nullable<UUID>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Any>& val) override;
/// Extracts a Nullable<Any>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a Nullable<Var>.
// Containers
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<char>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<UTF16String>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<UTF16String>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<UTF16String>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<float>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<double>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Data::Date>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Data::Date>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Data::Date>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Data::Time>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Data::Time>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Data::Time>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Data::BLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Data::CLOB>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::DateTime>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::DateTime>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::DateTime>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::UUID>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::UUID>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::UUID>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Any>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Any>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Any>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val) override;
/// Throws NotImplementedException.
bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val) override;
/// Throws NotImplementedException.
bool isNull(std::size_t pos, std::size_t row = POCO_DATA_INVALID_ROW) override;
/// Returns true if the current row value at pos column is null.
/// Because of the loss of information about null-ness of the
/// underlying database values due to the nature of SQLite engine,
@ -141,10 +439,18 @@ public:
/// The row argument, needed for connectors with bulk capabilities,
/// is ignored in this implementation.
void reset();
void reset() override;
/// Clears the cached nulls indicator vector.
private:
template <typename F, typename T>
bool extract(F func, std::size_t pos, T& val)
{
if (isNull(pos)) return false;
val = func(_pStmt, (int) pos);
return true;
}
template <typename T>
bool extractImpl(std::size_t pos, T& val)
/// Utility function for extraction of Any and Dynamic::Var.

View File

@ -20,6 +20,7 @@
#include "Poco/Data/DataException.h"
#include "Poco/DateTimeParser.h"
#include "Poco/Exception.h"
#include "Poco/Debugger.h"
#if defined(POCO_UNBUNDLED)
#include <sqlite3.h>
#else
@ -49,43 +50,19 @@ Extractor::~Extractor()
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int64, pos, val);
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, long& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, unsigned long& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
#endif
bool Extractor::extract(std::size_t pos, double& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_double(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_double, pos, val);
}
@ -101,59 +78,51 @@ bool Extractor::extract(std::size_t pos, std::string& val)
}
bool Extractor::extract(std::size_t pos, UTF16String& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int64, pos, val);
}
bool Extractor::extract(std::size_t pos, bool& val)
{
if (isNull(pos)) return false;
val = (0 != sqlite3_column_int(_pStmt, (int) pos));
return true;
return extract(sqlite3_column_int, pos, val);
}
@ -167,9 +136,7 @@ bool Extractor::extract(std::size_t pos, float& val)
bool Extractor::extract(std::size_t pos, char& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
return extract(sqlite3_column_int, pos, val);
}
@ -230,6 +197,299 @@ bool Extractor::extract(std::size_t pos, Dynamic::Var& val)
}
// Nullable
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int32>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int64>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, long& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, unsigned long& val)
{
if (isNull(pos)) return false;
val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<unsigned long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<unsigned long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<unsigned long>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, Nullable<long>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<unsigned long>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
#endif // POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t pos, Nullable<double>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_double(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<std::string>& val)
{
if (isNull(pos)) val.clear();
else
{
const char *pBuf = reinterpret_cast<const char*>(sqlite3_column_text(_pStmt, (int) pos));
if (!pBuf) val = ""s;
else val = pBuf;
}
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<UTF16String>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int8>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt8>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int16>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt16>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt32>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt64>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int64(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<bool>& val)
{
if (isNull(pos)) val.clear();
else val = (0 != sqlite3_column_int(_pStmt, (int) pos));
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<float>& val)
{
if (isNull(pos)) val.clear();
else val = static_cast<float>(sqlite3_column_double(_pStmt, (int) pos));
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<char>& val)
{
if (isNull(pos)) val.clear();
else val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Date>& val)
{
if (isNull(pos)) val.clear();
else
{
std::string str;
extract(pos, str);
int tzd;
val = DateTimeParser::parse(Utility::SQLITE_DATE_FORMAT, str, tzd);
}
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Time>& val)
{
if (isNull(pos)) val.clear();
else
{
std::string str;
extract(pos, str);
int tzd;
val = DateTimeParser::parse(Utility::SQLITE_TIME_FORMAT, str, tzd);
}
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<DateTime>& val)
{
if (isNull(pos)) val.clear();
else
{
std::string dt;
extract(pos, dt);
int tzd;
if (val.isNull()) val = DateTime();
DateTimeParser::parse(dt, val.value(), tzd);
}
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<UUID>& val)
{
if (isNull(pos)) val.clear();
else
{
std::string str;
extract(pos, str);
if (val.isNull()) val = UUID();
val.value().parse(str);
}
return true;
}
bool Extractor::extract(std::size_t pos, Nullable<Poco::Any>& val)
{
if (isNull(pos))
{
val.clear();
return true;
}
if (val.isNull()) val = Poco::Any();
return extractImpl(pos, val.value());
}
bool Extractor::extract(std::size_t pos, Nullable<Dynamic::Var>& val)
{
if (isNull(pos))
{
val.clear();
return true;
}
if (val.isNull()) val = Dynamic::Var();
return extractImpl(pos, val.value());
}
inline bool Extractor::extract(std::size_t pos, Nullable<Poco::Data::BLOB>& val)
{
if (isNull(pos))
{
val.clear();
return true;
}
if (val.isNull()) val = Poco::Data::BLOB();
return extractLOB<Poco::Data::BLOB::ValueType>(pos, val.value());
}
inline bool Extractor::extract(std::size_t pos, Nullable<Poco::Data::CLOB>& val)
{
if (isNull(pos))
{
val.clear();
return true;
}
if (val.isNull()) val = Poco::Data::CLOB();
return extractLOB<Poco::Data::CLOB::ValueType>(pos, val.value());
}
bool Extractor::isNull(std::size_t pos, std::size_t)
{
if (pos >= _nulls.size())
@ -245,4 +505,401 @@ bool Extractor::isNull(std::size_t pos, std::size_t)
}
// Containers
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<bool>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<bool>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<char>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<char>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<char>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<UTF16String>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<UTF16String>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<UTF16String>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<float>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<float>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<float>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<double>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<double>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<double>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Date>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Date>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Time>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Time>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::BLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::CLOB>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::DateTime>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::DateTime>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UUID>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UUID>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UUID>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Any>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val)
{
throw Poco::NotImplementedException(poco_src_loc);
}
} } } // namespace Poco::Data::SQLite

View File

@ -45,6 +45,7 @@
#include <iostream>
using namespace std::string_literals;
using namespace Poco::Data::Keywords;
using Poco::Data::Session;
using Poco::Data::Statement;
@ -62,6 +63,7 @@ using Poco::Data::Transaction;
using Poco::Data::AbstractExtractionVec;
using Poco::Data::AbstractExtractionVecVec;
using Poco::Data::AbstractBindingVec;
using Poco::Data::NullData;
using Poco::Data::NotConnectedException;
using Poco::Data::SQLite::Notifier;
using Poco::Nullable;
@ -2189,6 +2191,120 @@ void SQLiteTest::testNullable()
}
void SQLiteTest::testNullableVector()
{
Session ses (Poco::Data::SQLite::Connector::KEY, "dummy.db");
ses << "DROP TABLE IF EXISTS NullableTest", now;
ses << "CREATE TABLE NullableTest (i INTEGER, r REAL, s VARCHAR, d DATETIME)", now;
const int sz = 3;
std::vector<NullData> nd(sz, null);
ses << "INSERT INTO NullableTest VALUES(:i, :r, :s, :d)", use(nd), use(nd), use(nd), use(nd), now;
std::vector<Nullable<int>> v(sz, 1);
std::vector<Nullable<double>> f(sz, 1.5);
std::vector<Nullable<std::string>> s(sz, "abc"s);
std::vector<Nullable<DateTime>> d(sz, DateTime());
for (int i = 0; i < sz; ++i)
{
assertFalse (v[i].isNull());
assertFalse (f[i].isNull());
assertFalse (s[i].isNull());
assertFalse (d[i].isNull());
}
v.clear();
f.clear();
s.clear();
d.clear();
assertEqual (0, v.size());
assertEqual (0, f.size());
assertEqual (0, s.size());
assertEqual (0, d.size());
ses << "SELECT i, r, s, d FROM NullableTest", into(v), into(f), into(s), into(d), now;
assertEqual (sz, v.size());
assertEqual (sz, f.size());
assertEqual (sz, s.size());
assertEqual (sz, d.size());
for (int i = 0; i < sz; ++i)
{
assertTrue (v[i].isNull());
assertTrue (f[i].isNull());
assertTrue (s[i].isNull());
assertTrue (d[i].isNull());
}
ses << "DELETE FROM NullableTest", now;
ses << "SELECT i, r, s, d FROM NullableTest", into(v), into(f), into(s), into(d), now;
assertEqual (0, v.size());
assertEqual (0, f.size());
assertEqual (0, s.size());
assertEqual (0, d.size());
const std::vector<Nullable<int>> nv = {null, 2, 3};
const std::vector<Nullable<double>> nf = {1.5, null, 3.5};
const std::vector<Nullable<std::string>> ns = {"123"s, "abc"s, null};
const std::vector<Nullable<DateTime>> ndt = {null, DateTime(1965, 6, 18), null};
v = nv;
f = nf;
s = ns;
d = ndt;
ses << "INSERT INTO NullableTest VALUES(:i, :r, :s, :d)", use(v), use(f), use(s), use(d), now;
v.clear();
f.clear();
s.clear();
d.clear();
assertEqual (0, v.size());
assertEqual (0, f.size());
assertEqual (0, s.size());
assertEqual (0, d.size());
ses << "SELECT i, r, s, d FROM NullableTest", into(v), into(f), into(s), into(d), now;
assertEqual (sz, v.size());
assertEqual (sz, f.size());
assertEqual (sz, s.size());
assertEqual (sz, d.size());
assertTrue (v == nv);
assertTrue (f == nf);
assertTrue (s == ns);
assertTrue (d == ndt);
RecordSet rs(ses, "SELECT * FROM NullableTest");
rs.moveFirst();
assertTrue (rs.isNull("i"));
assertTrue (!rs.isNull("r"));
assertTrue (!rs.isNull("s"));
assertTrue (rs.isNull("d"));
assertTrue (rs.moveNext());
assertTrue (!rs.isNull("i"));
assertTrue (rs.isNull("r"));
assertTrue (!rs.isNull("s"));
assertTrue (!rs.isNull("d"));
assertTrue (rs.moveNext());
assertTrue (!rs.isNull("i"));
assertTrue (!rs.isNull("r"));
assertTrue (rs.isNull("s"));
assertTrue (rs.isNull("d"));
}
void SQLiteTest::testNulls()
{
Session ses (Poco::Data::SQLite::Connector::KEY, "dummy.db");
@ -3841,6 +3957,7 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testInternalExtraction);
CppUnit_addTest(pSuite, SQLiteTest, testPrimaryKeyConstraint);
CppUnit_addTest(pSuite, SQLiteTest, testNullable);
CppUnit_addTest(pSuite, SQLiteTest, testNullableVector);
CppUnit_addTest(pSuite, SQLiteTest, testNulls);
CppUnit_addTest(pSuite, SQLiteTest, testRowIterator);
CppUnit_addTest(pSuite, SQLiteTest, testAsync);

View File

@ -108,6 +108,7 @@ public:
void testInternalExtraction();
void testPrimaryKeyConstraint();
void testNullable();
void testNullableVector();
void testNulls();
void testRowIterator();
void testAsync();

View File

@ -21,6 +21,7 @@
#include "Poco/Data/Data.h"
#include "Poco/Data/Constants.h"
#include "Poco/Data/LOB.h"
#include "Poco/Nullable.h"
#include "Poco/UUID.h"
#include "Poco/UTFString.h"
#include "Poco/TextEncoding.h"
@ -66,97 +67,97 @@ public:
virtual bool extract(std::size_t pos, Poco::Int8& val) = 0;
/// Extracts an Int8. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val) = 0;
/// Extracts an Int8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val) = 0;
/// Extracts an Int8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val);
virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) = 0;
/// Extracts an UInt8 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) = 0;
/// Extracts an UInt8 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val);
virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val) = 0;
/// Extracts an UInt8 list.
virtual bool extract(std::size_t pos, Poco::Int16& val) = 0;
/// Extracts an Int16. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val);
virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val) = 0;
/// Extracts an Int16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val) = 0;
/// Extracts an Int16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val);
virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) = 0;
/// Extracts an UInt16 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) = 0;
/// Extracts an UInt16 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val);
virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val) = 0;
/// Extracts an Int32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val) = 0;
/// Extracts an Int32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val);
virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) = 0;
/// Extracts an UInt32 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) = 0;
/// Extracts an UInt32 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val);
virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val) = 0;
/// Extracts an Int64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val) = 0;
/// Extracts an Int64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val);
virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) = 0;
/// Extracts an UInt64 vector.
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) = 0;
/// Extracts an UInt64 deque.
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val) = 0;
/// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
@ -166,74 +167,83 @@ public:
virtual bool extract(std::size_t pos, unsigned long& val) = 0;
/// Extracts an unsigned long. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<long>& val);
virtual bool extract(std::size_t pos, std::vector<long>& val) = 0;
/// Extracts a long vector.
virtual bool extract(std::size_t pos, std::deque<long>& val);
virtual bool extract(std::size_t pos, std::deque<long>& val) = 0;
/// Extracts a long deque.
virtual bool extract(std::size_t pos, std::list<long>& val);
virtual bool extract(std::size_t pos, std::list<long>& val) = 0;
/// Extracts a long list.
virtual bool extract(std::size_t pos, std::vector<unsigned long>& val) = 0;
/// Extracts an unsigned long vector.
virtual bool extract(std::size_t pos, std::deque<unsigned long>& val) = 0;
/// Extracts an unsigned long deque.
virtual bool extract(std::size_t pos, std::list<unsigned long>& val) = 0;
/// Extracts an unsigned long list.
#endif
virtual bool extract(std::size_t pos, bool& val) = 0;
/// Extracts a boolean. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<bool>& val);
virtual bool extract(std::size_t pos, std::vector<bool>& val) = 0;
/// Extracts a boolean vector.
virtual bool extract(std::size_t pos, std::deque<bool>& val);
virtual bool extract(std::size_t pos, std::deque<bool>& val) = 0;
/// Extracts a boolean deque.
virtual bool extract(std::size_t pos, std::list<bool>& val);
virtual bool extract(std::size_t pos, std::list<bool>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<float>& val) = 0;
/// Extracts a float vector.
virtual bool extract(std::size_t pos, std::deque<float>& val);
virtual bool extract(std::size_t pos, std::deque<float>& val) = 0;
/// Extracts a float deque.
virtual bool extract(std::size_t pos, std::list<float>& val);
virtual bool extract(std::size_t pos, std::list<float>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<double>& val) = 0;
/// Extracts a double vector.
virtual bool extract(std::size_t pos, std::deque<double>& val);
virtual bool extract(std::size_t pos, std::deque<double>& val) = 0;
/// Extracts a double deque.
virtual bool extract(std::size_t pos, std::list<double>& val);
virtual bool extract(std::size_t pos, std::list<double>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<char>& val) = 0;
/// Extracts a character vector.
virtual bool extract(std::size_t pos, std::deque<char>& val);
virtual bool extract(std::size_t pos, std::deque<char>& val) = 0;
/// Extracts a character deque.
virtual bool extract(std::size_t pos, std::list<char>& val);
virtual bool extract(std::size_t pos, std::list<char>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<std::string>& val) = 0;
/// Extracts a string vector.
virtual bool extract(std::size_t pos, std::deque<std::string>& val);
virtual bool extract(std::size_t pos, std::deque<std::string>& val) = 0;
/// Extracts a string deque.
virtual bool extract(std::size_t pos, std::list<std::string>& val);
virtual bool extract(std::size_t pos, std::list<std::string>& val) = 0;
/// Extracts a string list.
virtual bool extract(std::size_t pos, UTF16String& val);
@ -254,58 +264,58 @@ public:
virtual bool extract(std::size_t pos, CLOB& val) = 0;
/// Extracts a CLOB. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<BLOB>& val);
virtual bool extract(std::size_t pos, std::vector<BLOB>& val) = 0;
/// Extracts a BLOB vector.
virtual bool extract(std::size_t pos, std::deque<BLOB>& val);
virtual bool extract(std::size_t pos, std::deque<BLOB>& val) = 0;
/// Extracts a BLOB deque.
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
virtual bool extract(std::size_t pos, std::list<BLOB>& val) = 0;
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, std::vector<CLOB>& val);
virtual bool extract(std::size_t pos, std::vector<CLOB>& val) = 0;
/// Extracts a CLOB vector.
virtual bool extract(std::size_t pos, std::deque<CLOB>& val);
virtual bool extract(std::size_t pos, std::deque<CLOB>& val) = 0;
/// Extracts a CLOB deque.
virtual bool extract(std::size_t pos, std::list<CLOB>& val);
virtual bool extract(std::size_t pos, std::list<CLOB>& val) = 0;
/// Extracts a CLOB 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);
virtual bool extract(std::size_t pos, std::vector<DateTime>& val) = 0;
/// Extracts a DateTime vector.
virtual bool extract(std::size_t pos, std::deque<DateTime>& val);
virtual bool extract(std::size_t pos, std::deque<DateTime>& val) = 0;
/// Extracts a DateTime deque.
virtual bool extract(std::size_t pos, std::list<DateTime>& val);
virtual bool extract(std::size_t pos, std::list<DateTime>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Date>& val) = 0;
/// Extracts a Date vector.
virtual bool extract(std::size_t pos, std::deque<Date>& val);
virtual bool extract(std::size_t pos, std::deque<Date>& val) = 0;
/// Extracts a Date deque.
virtual bool extract(std::size_t pos, std::list<Date>& val);
virtual bool extract(std::size_t pos, std::list<Date>& val) = 0;
/// 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);
virtual bool extract(std::size_t pos, std::vector<Time>& val) = 0;
/// Extracts a Time vector.
virtual bool extract(std::size_t pos, std::deque<Time>& val);
virtual bool extract(std::size_t pos, std::deque<Time>& val) = 0;
/// Extracts a Time deque.
virtual bool extract(std::size_t pos, std::list<Time>& val);
virtual bool extract(std::size_t pos, std::list<Time>& val) = 0;
/// Extracts a Time list.
virtual bool extract(std::size_t pos, UUID& val) = 0;
@ -323,27 +333,101 @@ public:
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);
virtual bool extract(std::size_t pos, std::vector<Any>& val) = 0;
/// Extracts an Any vector.
virtual bool extract(std::size_t pos, std::deque<Any>& val);
virtual bool extract(std::size_t pos, std::deque<Any>& val) = 0;
/// Extracts an Any deque.
virtual bool extract(std::size_t pos, std::list<Any>& val);
virtual bool extract(std::size_t pos, std::list<Any>& val) = 0;
/// Extracts an Any list.
virtual bool extract(std::size_t pos, Poco::Dynamic::Var& val) = 0;
/// Extracts a Var. Returns false if null was received.
virtual bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val);
virtual bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val) = 0;
/// Extracts a Var vector.
virtual bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val);
virtual bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val) = 0;
/// Extracts a Var deque.
virtual bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val);
virtual bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val) = 0;
/// Extracts a Var list.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val);
/// Extracts a nullable nullable Int8.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val);
/// Extracts a nullable nullable UInt8.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val);
/// Extracts a nullable nullable Int16.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val);
/// Extracts a nullable nullable UInt16.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val);
/// Extracts a nullable nullable Int32.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val);
/// Extracts a nullable nullable UInt32.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val);
/// Extracts a nullable nullable Int64.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val);
/// Extracts a nullable nullable UInt64.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, Poco::Nullable<long>& val);
/// Extracts a nullable long.
virtual bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val);
/// Extracts a nullable nullable unsigned long.
#endif
virtual bool extract(std::size_t pos, Poco::Nullable<bool>& val);
/// Extracts a nullable boolean.
virtual bool extract(std::size_t pos, Poco::Nullable<float>& val);
/// Extracts a nullable float.
virtual bool extract(std::size_t pos, Poco::Nullable<double>& val);
/// Extracts a nullable double.
virtual bool extract(std::size_t pos, Poco::Nullable<char>& val);
/// Extracts a nullable single character.
virtual bool extract(std::size_t pos, Poco::Nullable<std::string>& val);
/// Extracts a nullable string.
virtual bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val);
/// Extracts a nullable UTF16String.
virtual bool extract(std::size_t pos, Poco::Nullable<BLOB>& val);
/// Extracts a nullable BLOB.
virtual bool extract(std::size_t pos, Poco::Nullable<CLOB>& val);
/// Extracts a nullable CLOB.
virtual bool extract(std::size_t pos, Poco::Nullable<DateTime>& val);
/// Extracts a nullable DateTime.
virtual bool extract(std::size_t pos, Poco::Nullable<Date>& val);
/// Extracts a nullable Date.
virtual bool extract(std::size_t pos, Poco::Nullable<Time>& val);
/// Extracts a nullable Time.
virtual bool extract(std::size_t pos, Poco::Nullable<UUID>& val);
/// Extracts a nullable UUID.
virtual bool extract(std::size_t pos, Poco::Nullable<Any>& val);
/// Extracts a nullable nullable Any.
virtual bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val);
/// Extracts a nullable Var.
virtual bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) = 0;
/// Returns true if the value at [col,row] position is null.

View File

@ -21,6 +21,7 @@
#include "Poco/Data/Data.h"
#include "Poco/RefCountedObject.h"
#include "Poco/Data/LOB.h"
#include "Poco/Nullable.h"
#include "Poco/UUID.h"
#include "Poco/UTFString.h"
#include <vector>
@ -177,6 +178,15 @@ public:
virtual void prepare(std::size_t pos, const std::list<long>& val);
/// Prepares a long list.
virtual void prepare(std::size_t pos, const std::vector<unsigned long>& val);
/// Prepares a unsigned long vector.
virtual void prepare(std::size_t pos, const std::deque<unsigned long>& val);
/// Prepares a unsigned long deque.
virtual void prepare(std::size_t pos, const std::list<unsigned long>& val);
/// Prepares a unsigned long list.
#endif
virtual void prepare(std::size_t pos, const bool&) = 0;
@ -239,7 +249,7 @@ public:
virtual void prepare(std::size_t pos, const std::list<std::string>& val);
/// Prepares a character list.
virtual void prepare(std::size_t pos, const UTF16String&);
virtual void prepare(std::size_t pos, const UTF16String&) = 0;
/// Prepares a UTF16String.
virtual void prepare(std::size_t pos, const std::vector<UTF16String>& val);
@ -347,6 +357,296 @@ public:
virtual void prepare(std::size_t pos, const std::list<Poco::Dynamic::Var>& val);
/// Prepares a Var list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::Int8>&);
/// Prepares an Int8.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::Int8>>& val);
/// Prepares an Int8 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::Int8>>& val);
/// Prepares an Int8 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::Int8>>& val);
/// Prepares an Int8 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::UInt8>&);
/// Prepares an UInt8.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::UInt8>>& val);
/// Prepares an UInt8 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::UInt8>>& val);
/// Prepares an UInt8 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::UInt8>>& val);
/// Prepares an UInt8 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::Int16>&);
/// Prepares an Int16.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::Int16>>& val);
/// Prepares an Int16 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::Int16>>& val);
/// Prepares an Int16 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::Int16>>& val);
/// Prepares an Int16 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::UInt16>&);
/// Prepares an UInt16.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::UInt16>>& val);
/// Prepares an UInt16 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::UInt16>>& val);
/// Prepares an UInt16 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::UInt16>>& val);
/// Prepares an UInt16 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::Int32>&);
/// Prepares an Int32.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::Int32>>& val);
/// Prepares an Int32 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::Int32>>& val);
/// Prepares an Int32 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::Int32>>& val);
/// Prepares an Int32 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::UInt32>&);
/// Prepares an UInt32.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::UInt32>>& val);
/// Prepares an UInt32 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::UInt32>>& val);
/// Prepares an UInt32 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::UInt32>>& val);
/// Prepares an UInt32 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::Int64>&);
/// Prepares an Int64.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::Int64>>& val);
/// Prepares an Int64 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::Int64>>& val);
/// Prepares an Int64 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::Int64>>& val);
/// Prepares an Int64 list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::UInt64>&);
/// Prepares an UInt64.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::UInt64>>& val);
/// Prepares an UInt64 vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::UInt64>>& val);
/// Prepares an UInt64 deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::UInt64>>& val);
/// Prepares an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual void prepare(std::size_t pos, const Poco::Nullable<long>&);
/// Prepares a long.
virtual void prepare(std::size_t pos, const Poco::Nullable<unsigned long>&);
/// Prepares an unsigned long.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<long>>& val);
/// Prepares a long vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<long>>& val);
/// Prepares a long deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<long>>& val);
/// Prepares a long list.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<unsigned long>>& val);
/// Prepares a unsigned long vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<unsigned long>>& val);
/// Prepares a unsigned long deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<unsigned long>>& val);
/// Prepares a unsigned long list.
#endif
virtual void prepare(std::size_t pos, const Poco::Nullable<bool>&);
/// Prepares a boolean.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<bool>>& val);
/// Prepares a boolean vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<bool>>& val);
/// Prepares a boolean deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<bool>>& val);
/// Prepares a boolean list.
virtual void prepare(std::size_t pos, const Poco::Nullable<float>&);
/// Prepares a float.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<float>>& val);
/// Prepares a float vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<float>>& val);
/// Prepares a float deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<float>>& val);
/// Prepares a float list.
virtual void prepare(std::size_t pos, const Poco::Nullable<double>&);
/// Prepares a double.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<double>>& val);
/// Prepares a double vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<double>>& val);
/// Prepares a double deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<double>>& val);
/// Prepares a double list.
virtual void prepare(std::size_t pos, const Poco::Nullable<char>&);
/// Prepares a single character.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<char>>& val);
/// Prepares a character vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<char>>& val);
/// Prepares a character deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<char>>& val);
/// Prepares a character list.
virtual void prepare(std::size_t pos, const Poco::Nullable<std::string>&);
/// Prepares a string.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<std::string>>& val);
/// Prepares a string vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<std::string>>& val);
/// Prepares a string deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<std::string>>& val);
/// Prepares a character list.
virtual void prepare(std::size_t pos, const Poco::Nullable<UTF16String>&);
/// Prepares a UTF16String.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<UTF16String>>& val);
/// Prepares a UTF16String vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<UTF16String>>& val);
/// Prepares a UTF16String deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<UTF16String>>& val);
/// Prepares a UTF16String list.
virtual void prepare(std::size_t pos, const Poco::Nullable<BLOB>&);
/// Prepares a BLOB.
virtual void prepare(std::size_t pos, const Poco::Nullable<CLOB>&);
/// Prepares a CLOB.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<BLOB>>& val);
/// Prepares a BLOB vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<BLOB>>& val);
/// Prepares a BLOB deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<BLOB>>& val);
/// Prepares a BLOB list.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<CLOB>>& val);
/// Prepares a CLOB vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<CLOB>>& val);
/// Prepares a CLOB deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<CLOB>>& val);
/// Prepares a CLOB list.
virtual void prepare(std::size_t pos, const Poco::Nullable<DateTime>&);
/// Prepares a DateTime.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<DateTime>>& val);
/// Prepares a DateTime vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<DateTime>>& val);
/// Prepares a DateTime deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<DateTime>>& val);
/// Prepares a DateTime list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Date>&);
/// Prepares a Date.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Date>>& val);
/// Prepares a Date vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Date>>& val);
/// Prepares a Date deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Date>>& val);
/// Prepares a Date list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Time>&);
/// Prepares a Time.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Time>>& val);
/// Prepares a Time vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Time>>& val);
/// Prepares a Time deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Time>>& val);
/// Prepares a Time list.
virtual void prepare(std::size_t pos, const Poco::Nullable<UUID>&);
/// Prepares a UUID.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<UUID>>& val);
/// Prepares a UUID vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<UUID>>& val);
/// Prepares a UUID deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<UUID>>& val);
/// Prepares a UUID list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Any>&);
/// Prepares an Any.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Any>>& val);
/// Prepares an Any vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Any>>& val);
/// Prepares an Any deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Any>>& val);
/// Prepares an Any list.
virtual void prepare(std::size_t pos, const Poco::Nullable<Poco::Dynamic::Var>&);
/// Prepares a Var.
virtual void prepare(std::size_t pos, const std::vector<Poco::Nullable<Poco::Dynamic::Var>>& val);
/// Prepares a Var vector.
virtual void prepare(std::size_t pos, const std::deque<Poco::Nullable<Poco::Dynamic::Var>>& val);
/// Prepares a Var deque.
virtual void prepare(std::size_t pos, const std::list<Poco::Nullable<Poco::Dynamic::Var>>& val);
/// Prepares a Var 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

@ -292,20 +292,10 @@ public:
static void extract(std::size_t pos, Nullable<T>& obj, const Nullable<T>& , AbstractExtractor::Ptr pExt)
{
poco_assert_dbg (!pExt.isNull());
T val;
if (pExt->extract(pos++, val))
{
obj = std::move(val);
}
else
{
obj.clear();
}
pExt->extract(pos++, obj);
}
private:
TypeHandler();
~TypeHandler();
TypeHandler(const TypeHandler&);

View File

@ -47,425 +47,191 @@ void AbstractExtractor::reverseTranscode(const std::string& from, std::string& t
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
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_INT64_IS_LONG
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
bool AbstractExtractor::extract(std::size_t pos, std::vector<bool>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
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, UTF16String& val)
{
throw NotImplementedException("UTF16String extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<UTF16String>& val)
{
throw NotImplementedException("std::vector<UTF16String> extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<UTF16String>& val)
{
throw NotImplementedException("std::deque<UTF16String> extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::list<UTF16String>& val)
{
throw NotImplementedException("std::list<UTF16String> 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<CLOB>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<CLOB>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool AbstractExtractor::extract(std::size_t pos, std::list<CLOB>& 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.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<UUID>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<UUID>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::list<UUID>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Any>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Any>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Any>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val)
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
throw NotImplementedException(poco_src_loc);
}
#ifndef POCO_INT64_IS_LONG
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
throw NotImplementedException(poco_src_loc);
}
#endif
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<UTF16String>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<BLOB>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<CLOB>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<DateTime>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Date>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Time>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<UUID>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Any>& val)
{
throw NotImplementedException(poco_src_loc);
}
bool AbstractExtractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
throw NotImplementedException(poco_src_loc);
}

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@
#include "Poco/Glob.h"
#include "Poco/File.h"
#include "Poco/Path.h"
#include "Poco/Nullable.h"
#include <string>
#include <cstring>
#include <sstream>
@ -1164,7 +1165,6 @@ void DataTest::testRowSort()
testRowStrictWeak(row10, row9, row8);
Row row11;
row11.append("0", 2.5);
row11.append("1", 2.5);
@ -1604,6 +1604,17 @@ void DataTest::testSQLChannel()
}
void DataTest::testNullableExtract()
{
Poco::Data::Test::Extractor ext;
Poco::Nullable<Poco::Int32> ni;
assertTrue (ni.isNull());
assertTrue (ext.extract(0, ni));
assertFalse (ni.isNull());
assertEqual (ni.value(), 1);
}
void DataTest::setUp()
{
}
@ -1638,6 +1649,7 @@ CppUnit::Test* DataTest::suite()
CppUnit_addTest(pSuite, DataTest, testTranscode);
CppUnit_addTest(pSuite, DataTest, testSQLParse);
CppUnit_addTest(pSuite, DataTest, testSQLChannel);
CppUnit_addTest(pSuite, DataTest, testNullableExtract);
return pSuite;
}

View File

@ -47,6 +47,7 @@ public:
void testTranscode();
void testSQLParse();
void testSQLChannel();
void testNullableExtract();
void setUp();
void tearDown();

View File

@ -29,6 +29,8 @@ Extractor::~Extractor()
}
// Int8
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
{
val = 0;
@ -36,6 +38,32 @@ bool Extractor::extract(std::size_t pos, Poco::Int8& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val)
{
return true;
}
// UInt8
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
{
val = 0;
@ -43,6 +71,32 @@ bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val)
{
return true;
}
// Int16
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
{
val = 0;
@ -50,6 +104,32 @@ bool Extractor::extract(std::size_t pos, Poco::Int16& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val)
{
return true;
}
// UInt16
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
{
val = 0;
@ -57,6 +137,32 @@ bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val)
{
return true;
}
// Int32
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
{
val = 0;
@ -64,6 +170,33 @@ bool Extractor::extract(std::size_t pos, Poco::Int32& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val)
{
val = 1;
return true;
}
// UInt32
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
{
val = 0;
@ -71,6 +204,32 @@ bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val)
{
return true;
}
// Int64
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
{
val = 0;
@ -78,7 +237,33 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val)
{
return true;
}
#ifndef POCO_INT64_IS_LONG
// long
bool Extractor::extract(std::size_t pos, long& val)
{
val = 0;
@ -86,14 +271,66 @@ bool Extractor::extract(std::size_t pos, long& val)
}
bool Extractor::extract(std::size_t pos, std::vector<long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<long>& val)
{
return true;
}
// unsigned long
bool Extractor::extract(std::size_t pos, unsigned long& val)
{
val = 0;
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<unsigned long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<unsigned long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<unsigned long>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<unsigned long>& val)
{
return true;
}
#endif
// UInt64
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
{
val = 0;
@ -101,6 +338,32 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val)
{
return true;
}
// bool
bool Extractor::extract(std::size_t pos, bool& val)
{
val = false;
@ -108,6 +371,32 @@ bool Extractor::extract(std::size_t pos, bool& val)
}
bool Extractor::extract(std::size_t pos, std::vector<bool>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<bool>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<bool>& val)
{
return true;
}
// float
bool Extractor::extract(std::size_t pos, float& val)
{
val = 0;
@ -115,6 +404,32 @@ bool Extractor::extract(std::size_t pos, float& val)
}
bool Extractor::extract(std::size_t pos, std::vector<float>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<float>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<float>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<float>& val)
{
return true;
}
// double
bool Extractor::extract(std::size_t pos, double& val)
{
val = 0;
@ -122,6 +437,32 @@ bool Extractor::extract(std::size_t pos, double& val)
}
bool Extractor::extract(std::size_t pos, std::vector<double>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<double>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<double>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<double>& val)
{
return true;
}
// char
bool Extractor::extract(std::size_t pos, char& val)
{
val = '\0';
@ -129,6 +470,32 @@ bool Extractor::extract(std::size_t pos, char& val)
}
bool Extractor::extract(std::size_t pos, std::vector<char>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<char>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<char>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<char>& val)
{
return true;
}
// std::string
bool Extractor::extract(std::size_t pos, std::string& val)
{
if (!transcodeRequired())
@ -139,6 +506,32 @@ bool Extractor::extract(std::size_t pos, std::string& val)
}
bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<std::string>& val)
{
return true;
}
// UTF16String
bool Extractor::extract(std::size_t pos, Poco::UTF16String& val)
{
std::string str("");
@ -147,51 +540,284 @@ bool Extractor::extract(std::size_t pos, Poco::UTF16String& val)
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UTF16String>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UTF16String>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UTF16String>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UTF16String>& val)
{
return true;
}
// BLOB
bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::BLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Data::BLOB>& val)
{
return true;
}
// CLOB
bool Extractor::extract(std::size_t pos, Poco::Data::CLOB& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::CLOB>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Data::CLOB>& val)
{
return true;
}
// Date
bool Extractor::extract(std::size_t pos, Poco::Data::Date& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Date>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Date>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Data::Date>& val)
{
return true;
}
// Time
bool Extractor::extract(std::size_t pos, Poco::Data::Time& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Time>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Time>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Data::Time>& val)
{
return true;
}
// DateTime
bool Extractor::extract(std::size_t pos, Poco::DateTime& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::DateTime>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::DateTime>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::DateTime>& val)
{
return true;
}
// UUID
bool Extractor::extract(std::size_t pos, Poco::UUID& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::UUID>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::UUID>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::UUID>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::UUID>& val)
{
return true;
}
// Any
bool Extractor::extract(std::size_t pos, Poco::Any& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Any>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Any>& val)
{
return true;
}
// Var
bool Extractor::extract(std::size_t pos, Poco::Dynamic::Var& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val)
{
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val)
{
return true;
}
} } } // namespace Poco::Data::Test

View File

@ -32,80 +32,393 @@ public:
~Extractor();
/// Destroys the Extractor.
bool extract(std::size_t pos, Poco::Int8& val);
// Int8
bool extract(std::size_t pos, Poco::Int8& val) override;
/// Extracts an Int8.
bool extract(std::size_t pos, Poco::UInt8& val);
bool extract(std::size_t pos, std::vector<Poco::Int8>& val) override;
/// Extracts a std::vector<Int8>.
bool extract(std::size_t pos, std::deque<Poco::Int8>& val) override;
/// Extracts a std::deque<Int8>.
bool extract(std::size_t pos, std::list<Poco::Int8>& val) override;
/// Extracts a std::list<Int8>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int8>& val) override;
/// Extracts a Nullable<Int8>.
// UInt8
bool extract(std::size_t pos, Poco::UInt8& val) override;
/// Extracts an UInt8.
bool extract(std::size_t pos, Poco::Int16& val);
bool extract(std::size_t pos, std::vector<Poco::UInt8>& val) override;
/// Extracts a std::vector<UInt8>.
bool extract(std::size_t pos, std::deque<Poco::UInt8>& val) override;
/// Extracts a std::deque<UInt8>.
bool extract(std::size_t pos, std::list<Poco::UInt8>& val) override;
/// Extracts a std::list<UInt8>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt8>& val) override;
/// Extracts a Nullable<UInt8>.
// Int16
bool extract(std::size_t pos, Poco::Int16& val) override;
/// Extracts an Int16.
bool extract(std::size_t pos, Poco::UInt16& val);
bool extract(std::size_t pos, std::vector<Poco::Int16>& val) override;
/// Extracts a std::vector<Int16>.
bool extract(std::size_t pos, std::deque<Poco::Int16>& val) override;
/// Extracts a std::deque<Int16>.
bool extract(std::size_t pos, std::list<Poco::Int16>& val) override;
/// Extracts a std::list<Int16>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int16>& val) override;
/// Extracts a Nullable<Int16>.
// UInt16
bool extract(std::size_t pos, Poco::UInt16& val) override;
/// Extracts an UInt16.
bool extract(std::size_t pos, Poco::Int32& val);
bool extract(std::size_t pos, std::vector<Poco::UInt16>& val) override;
/// Extracts a std::vector<UInt16>.
bool extract(std::size_t pos, std::deque<Poco::UInt16>& val) override;
/// Extracts a std::deque<UInt16>.
bool extract(std::size_t pos, std::list<Poco::UInt16>& val) override;
/// Extracts a std::list<UInt16>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt16>& val) override;
/// Extracts a Nullable<UInt16>.
// Int32
bool extract(std::size_t pos, Poco::Int32& val) override;
/// Extracts an Int32.
bool extract(std::size_t pos, Poco::UInt32& val);
bool extract(std::size_t pos, std::vector<Poco::Int32>& val) override;
/// Extracts a std::vector<Int32>.
bool extract(std::size_t pos, std::deque<Poco::Int32>& val) override;
/// Extracts a std::deque<Int32>.
bool extract(std::size_t pos, std::list<Poco::Int32>& val) override;
/// Extracts a std::list<Int32>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int32>& val) override;
/// Extracts a Nullable<Int32>.
// UInt32
bool extract(std::size_t pos, Poco::UInt32& val) override;
/// Extracts an UInt32.
bool extract(std::size_t pos, Poco::Int64& val);
bool extract(std::size_t pos, std::vector<Poco::UInt32>& val) override;
/// Extracts a std::vector<UInt32>.
bool extract(std::size_t pos, std::deque<Poco::UInt32>& val) override;
/// Extracts a std::deque<UInt32>.
bool extract(std::size_t pos, std::list<Poco::UInt32>& val) override;
/// Extracts a std::list<UInt32>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt32>& val) override;
/// Extracts a Nullable<UInt32>.
// Int64
bool extract(std::size_t pos, Poco::Int64& val) override;
/// Extracts an Int64.
bool extract(std::size_t pos, Poco::UInt64& val);
bool extract(std::size_t pos, std::vector<Poco::Int64>& val) override;
/// Extracts a std::vector<Int64>.
bool extract(std::size_t pos, std::deque<Poco::Int64>& val) override;
/// Extracts a std::deque<Int64>.
bool extract(std::size_t pos, std::list<Poco::Int64>& val) override;
/// Extracts a std::list<Int64>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Int64>& val) override;
/// Extracts a Nullable<Int64>.
// UInt64
bool extract(std::size_t pos, Poco::UInt64& val) override;
/// Extracts an UInt64.
bool extract(std::size_t pos, Poco::Any& val);
bool extract(std::size_t pos, std::vector<Poco::UInt64>& val) override;
/// Extracts a std::vector<UInt64>.
bool extract(std::size_t pos, std::deque<Poco::UInt64>& val) override;
/// Extracts a std::deque<UInt64>.
bool extract(std::size_t pos, std::list<Poco::UInt64>& val) override;
/// Extracts a std::list<UInt64>.
bool extract(std::size_t pos, Poco::Nullable<Poco::UInt64>& val) override;
/// Extracts a Nullable<UInt64>.
// Any
bool extract(std::size_t pos, Poco::Any& val) override;
/// Extracts an Any.
bool extract(std::size_t pos, Poco::Dynamic::Var& val);
bool extract(std::size_t pos, std::vector<Poco::Any>& val) override;
/// Extracts a std::vector<Poco::Any>.
bool extract(std::size_t pos, std::deque<Poco::Any>& val) override;
/// Extracts a std::deque<Poco::Any>.
bool extract(std::size_t pos, std::list<Poco::Any>& val) override;
/// Extracts a std::list<Poco::Any>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Any>& val) override;
/// Extracts a Nullable<Poco::Any>.
// Var
bool extract(std::size_t pos, Poco::Dynamic::Var& val) override;
/// Extracts a Var.
bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val) override;
/// Extracts a std::vector<Poco::Dynamic::Var>.
bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val) override;
/// Extracts a std::deque<Poco::Dynamic::Var>.
bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val) override;
/// Extracts a std::list<Poco::Dynamic::Var>.
bool extract(std::size_t pos, Poco::Nullable<Poco::Dynamic::Var>& val) override;
/// Extracts a Nullable<Poco::Dynamic::Var>.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val);
// long
bool extract(std::size_t pos, long& val) override;
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long.
bool extract(std::size_t pos, std::vector<long>& val) override;
/// Extracts a std::vector<long>.
bool extract(std::size_t pos, std::deque<long>& val) override;
/// Extracts a std::deque<long>.
bool extract(std::size_t pos, std::list<long>& val) override;
/// Extracts a std::list<long>.
bool extract(std::size_t pos, Poco::Nullable<long>& val) override;
/// Extracts a Nullable<long>.
// unsigned long
bool extract(std::size_t pos, unsigned long& val) override;
/// Extracts an unsigned unsigned long.
bool extract(std::size_t pos, std::vector<unsigned long>& val) override;
/// Extracts a std::vector<unsigned long>.
bool extract(std::size_t pos, std::deque<unsigned long>& val) override;
/// Extracts a std::deque<unsigned long>.
bool extract(std::size_t pos, std::list<unsigned long>& val) override;
/// Extracts a std::list<unsigned long>.
bool extract(std::size_t pos, Poco::Nullable<unsigned long>& val) override;
/// Extracts a Nullable<unsigned long>.
#endif
bool extract(std::size_t pos, bool& val);
// bool
bool extract(std::size_t pos, bool& val) override;
/// Extracts a boolean.
bool extract(std::size_t pos, float& val);
bool extract(std::size_t pos, std::vector<bool>& val) override;
/// Extracts a std::vector<bool>.
bool extract(std::size_t pos, std::deque<bool>& val) override;
/// Extracts a std::deque<bool>.
bool extract(std::size_t pos, std::list<bool>& val) override;
/// Extracts a std::list<bool>.
bool extract(std::size_t pos, Poco::Nullable<bool>& val) override;
/// Extracts a Nullable<bool>.
// float
bool extract(std::size_t pos, float& val) override;
/// Extracts a float.
bool extract(std::size_t pos, double& val);
bool extract(std::size_t pos, std::vector<float>& val) override;
/// Extracts a std::vector<float>.
bool extract(std::size_t pos, std::deque<float>& val) override;
/// Extracts a std::deque<float>.
bool extract(std::size_t pos, std::list<float>& val) override;
/// Extracts a std::list<float>.
bool extract(std::size_t pos, Poco::Nullable<float>& val) override;
/// Extracts a Nullable<float>.
// double
bool extract(std::size_t pos, double& val) override;
/// Extracts a double.
bool extract(std::size_t pos, char& val);
bool extract(std::size_t pos, std::vector<double>& val) override;
/// Extracts a std::vector<double>.
bool extract(std::size_t pos, std::deque<double>& val) override;
/// Extracts a std::deque<double>.
bool extract(std::size_t pos, std::list<double>& val) override;
/// Extracts a std::list<double>.
bool extract(std::size_t pos, Poco::Nullable<double>& val) override;
/// Extracts a Nullable<double>.
// char
bool extract(std::size_t pos, char& val) override;
/// Extracts a single character.
bool extract(std::size_t pos, std::string& val);
bool extract(std::size_t pos, std::vector<char>& val) override;
/// Extracts a std::vector<char>.
bool extract(std::size_t pos, std::deque<char>& val) override;
/// Extracts a std::deque<char>.
bool extract(std::size_t pos, std::list<char>& val) override;
/// Extracts a std::list<char>.
bool extract(std::size_t pos, Poco::Nullable<char>& val) override;
/// Extracts a Nullable<char>.
// string
bool extract(std::size_t pos, std::string& val) override;
/// Extracts a string.
bool extract(std::size_t pos, Poco::UTF16String& val);
bool extract(std::size_t pos, std::vector<std::string>& val) override;
/// Extracts a std::vector<std::string>.
bool extract(std::size_t pos, std::deque<std::string>& val) override;
/// Extracts a std::deque<std::string>.
bool extract(std::size_t pos, std::list<std::string>& val) override;
/// Extracts a std::list<std::string>.
bool extract(std::size_t pos, Poco::Nullable<std::string>& val) override;
/// Extracts a Nullable<std::string>.
// UTF16String
bool extract(std::size_t pos, Poco::UTF16String& val) override;
/// Extracts a UTF16String.
bool extract(std::size_t pos, Poco::Data::BLOB& val);
bool extract(std::size_t pos, std::vector<UTF16String>& val) override;
/// Extracts a std::vector<UTF16String>.
bool extract(std::size_t pos, std::deque<UTF16String>& val) override;
/// Extracts a std::deque<UTF16String>.
bool extract(std::size_t pos, std::list<UTF16String>& val) override;
/// Extracts a std::list<UTF16String>.
bool extract(std::size_t pos, Poco::Nullable<UTF16String>& val) override;
/// Extracts a Nullable<UTF16String>.
// BLOB
bool extract(std::size_t pos, Poco::Data::BLOB& val) override;
/// Extracts a BLOB.
bool extract(std::size_t pos, Poco::Data::CLOB& val);
bool extract(std::size_t pos, std::vector<BLOB>& val) override;
/// Extracts a std::vector<BLOB>.
bool extract(std::size_t pos, std::deque<BLOB>& val) override;
/// Extracts a std::deque<BLOB>.
bool extract(std::size_t pos, std::list<BLOB>& val) override;
/// Extracts a std::list<BLOB>.
bool extract(std::size_t pos, Poco::Nullable<BLOB>& val) override;
/// Extracts a Nullable<BLOB>.
// CLOB
bool extract(std::size_t pos, Poco::Data::CLOB& val) override;
/// Extracts a CLOB.
bool extract(std::size_t pos, Date& val);
bool extract(std::size_t pos, std::vector<CLOB>& val) override;
/// Extracts a std::vector<CLOB>.
bool extract(std::size_t pos, std::deque<CLOB>& val) override;
/// Extracts a std::deque<CLOB>.
bool extract(std::size_t pos, std::list<CLOB>& val) override;
/// Extracts a std::list<CLOB>.
bool extract(std::size_t pos, Poco::Nullable<CLOB>& val) override;
/// Extracts a Nullable<CLOB>.
// Date
bool extract(std::size_t pos, Date& val) override;
/// Extracts a Date.
bool extract(std::size_t pos, Time& val);
bool extract(std::size_t pos, std::vector<Date>& val) override;
/// Extracts a std::vector<Date>.
bool extract(std::size_t pos, std::deque<Date>& val) override;
/// Extracts a std::deque<Date>.
bool extract(std::size_t pos, std::list<Date>& val) override;
/// Extracts a std::list<Date>.
bool extract(std::size_t pos, Poco::Nullable<Date>& val) override;
/// Extracts a Nullable<Date>.
// Time
bool extract(std::size_t pos, Time& val) override;
/// Extracts a Time.
bool extract(std::size_t pos, DateTime& val);
bool extract(std::size_t pos, std::vector<Time>& val) override;
/// Extracts a std::vector<Time>.
bool extract(std::size_t pos, std::deque<Time>& val) override;
/// Extracts a std::deque<Time>.
bool extract(std::size_t pos, std::list<Time>& val) override;
/// Extracts a std::list<Time>.
bool extract(std::size_t pos, Poco::Nullable<Time>& val) override;
/// Extracts a Nullable<Time>.
// DateTime
bool extract(std::size_t pos, DateTime& val) override;
/// Extracts a DateTime.
bool extract(std::size_t pos, UUID& val);
bool extract(std::size_t pos, std::vector<DateTime>& val) override;
/// Extracts a std::vector<DateTime>.
bool extract(std::size_t pos, std::deque<DateTime>& val) override;
/// Extracts a std::deque<DateTime>.
bool extract(std::size_t pos, std::list<DateTime>& val) override;
/// Extracts a std::list<DateTime>.
bool extract(std::size_t pos, Poco::Nullable<DateTime>& val) override;
/// Extracts a Nullable<DateTime>.
// UUID
bool extract(std::size_t pos, UUID& val) override;
/// Extracts a UUID.
bool extract(std::size_t pos, std::vector<UUID>& val) override;
/// Extracts a std::vector<UUID>.
bool extract(std::size_t pos, std::deque<UUID>& val) override;
/// Extracts a std::deque<UUID>.
bool extract(std::size_t pos, std::list<UUID>& val) override;
/// Extracts a std::list<UUID>.
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
/// Extracts a Nullable<UUID>.
bool isNull(std::size_t col, std::size_t row = -1);
/// Returns true if the current row value at pos column is null.

View File

@ -53,6 +53,8 @@ class Nullable
/// default construction.
{
public:
using Type = C;
Nullable()
/// Creates an empty Nullable.
{
@ -242,13 +244,13 @@ public:
return deflt;
}
operator C& ()
explicit operator C& ()
/// Get reference to the value
{
return value();
}
operator const C& () const
explicit operator const C& () const
/// Get const reference to the value
{
return value();

View File

@ -116,6 +116,13 @@ std::string demangle()
}
template <typename T>
std::string demangle(const T& t)
{
return demangle(typeid(std::remove_const_t<std::remove_reference_t<decltype(t)>>).name());
}
} // namespace Poco