mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 19:51:58 +01:00
GH #290: Unicode support
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "Poco/Nullable.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
@@ -246,6 +247,18 @@ public:
|
||||
virtual void bind(std::size_t pos, const std::list<std::string>& val, Direction dir = PD_IN);
|
||||
/// Binds a string list.
|
||||
|
||||
virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN) = 0;
|
||||
/// Binds a string.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::vector<UTF16String>& val, Direction dir = PD_IN);
|
||||
/// Binds a string vector.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::deque<UTF16String>& val, Direction dir = PD_IN);
|
||||
/// Binds a string deque.
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<UTF16String>& val, Direction dir = PD_IN);
|
||||
/// Binds a string list.
|
||||
|
||||
virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN) = 0;
|
||||
/// Binds a BLOB.
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/Limit.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
@@ -144,7 +145,26 @@ public:
|
||||
/// - string is empty
|
||||
/// - getEmptyStringIsNull() returns true
|
||||
|
||||
bool isValueNull(const Poco::UTF16String& str, bool deflt);
|
||||
/// Overload for const reference to UTF16String.
|
||||
///
|
||||
/// Returns true when folowing conditions are met:
|
||||
///
|
||||
/// - string is empty
|
||||
/// - getEmptyStringIsNull() returns true
|
||||
|
||||
private:
|
||||
template <typename S>
|
||||
bool isStringNull(const S& str, bool deflt)
|
||||
{
|
||||
if (getForceEmptyString()) return false;
|
||||
|
||||
if (getEmptyStringIsNull() && str.empty())
|
||||
return true;
|
||||
|
||||
return deflt;
|
||||
}
|
||||
|
||||
ExtractorPtr _pExtractor;
|
||||
Poco::UInt32 _limit;
|
||||
Poco::UInt32 _position;
|
||||
@@ -242,6 +262,18 @@ inline bool AbstractExtraction::getForceEmptyString() const
|
||||
}
|
||||
|
||||
|
||||
inline bool AbstractExtraction::isValueNull(const std::string& str, bool deflt)
|
||||
{
|
||||
return isStringNull(str, deflt);
|
||||
}
|
||||
|
||||
|
||||
inline bool AbstractExtraction::isValueNull(const Poco::UTF16String& str, bool deflt)
|
||||
{
|
||||
return isStringNull(str, deflt);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
@@ -233,6 +234,18 @@ public:
|
||||
virtual bool extract(std::size_t pos, std::list<std::string>& val);
|
||||
/// Extracts a string list.
|
||||
|
||||
virtual bool extract(std::size_t pos, UTF16String& val) = 0;
|
||||
/// Extracts a string. Returns false if null was received.
|
||||
|
||||
virtual bool extract(std::size_t pos, std::vector<UTF16String>& val);
|
||||
/// Extracts a string vector.
|
||||
|
||||
virtual bool extract(std::size_t pos, std::deque<UTF16String>& val);
|
||||
/// Extracts a string deque.
|
||||
|
||||
virtual bool extract(std::size_t pos, std::list<UTF16String>& val);
|
||||
/// Extracts a string list.
|
||||
|
||||
virtual bool extract(std::size_t pos, BLOB& val) = 0;
|
||||
/// Extracts a BLOB. Returns false if null was received.
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/// Destroys the AbstractPreparation.
|
||||
|
||||
virtual void prepare() = 0;
|
||||
/// Preparations data.
|
||||
/// Prepares data.
|
||||
|
||||
protected:
|
||||
AbstractPreparation();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
@@ -237,6 +238,18 @@ public:
|
||||
/// Prepares a string deque.
|
||||
|
||||
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&) = 0;
|
||||
/// Prepares a string.
|
||||
|
||||
virtual void prepare(std::size_t pos, const std::vector<UTF16String>& val);
|
||||
/// Prepares a string vector.
|
||||
|
||||
virtual void prepare(std::size_t pos, const std::deque<UTF16String>& val);
|
||||
/// Prepares a string deque.
|
||||
|
||||
virtual void prepare(std::size_t pos, const std::list<UTF16String>& val);
|
||||
/// Prepares a string list.
|
||||
|
||||
virtual void prepare(std::size_t pos, const BLOB&) = 0;
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
FDT_FLOAT,
|
||||
FDT_DOUBLE,
|
||||
FDT_STRING,
|
||||
FDT_WSTRING,
|
||||
FDT_BLOB,
|
||||
FDT_CLOB,
|
||||
FDT_DATE,
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
void prepare()
|
||||
/// Preparations data.
|
||||
/// Prepares data.
|
||||
{
|
||||
TypeHandler<T>::prepare(_pos, _val, preparation());
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
void prepare()
|
||||
/// Preparations data.
|
||||
/// Prepares data.
|
||||
{
|
||||
TypeHandler<std::vector<T> >::prepare(_pos, _val, preparation());
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
}
|
||||
|
||||
void prepare()
|
||||
/// Preparations data.
|
||||
/// Prepares data.
|
||||
{
|
||||
TypeHandler<std::deque<T> >::prepare(_pos, _val, preparation());
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
}
|
||||
|
||||
void prepare()
|
||||
/// Preparations data.
|
||||
/// Prepares data.
|
||||
{
|
||||
TypeHandler<std::list<T> >::prepare(_pos, _val, preparation());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user