Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/data db encoding #3321

Closed
wants to merge 124 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
e338928
Enable unit test in cmake build
Bjoe Jan 14, 2020
122ef59
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 15, 2020
386f43b
Merge branch 'poco-1.10.0' into devel
Bjoe Jan 15, 2020
b02b2c1
Merge branch 'poco-1.10.0' into devel
Bjoe Jan 15, 2020
7be832b
add BLOB SQLite test
aleks-f Jan 15, 2020
a2227c3
accept notifications by name (if they have one)
aleks-f Jan 15, 2020
07c1103
catch std::exception on parsing
aleks-f Jan 15, 2020
150b9e2
fix a leak, add some table features
aleks-f Jan 15, 2020
9932be9
few PostgreSQL fixes
aleks-f Jan 16, 2020
cba6914
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 17, 2020
adc99f0
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 22, 2020
0a796f9
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 22, 2020
303ddee
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 22, 2020
bccea84
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 23, 2020
0d6e947
GH #2351: WebSocket docs
obiltschnig Jan 23, 2020
ff89364
Merge branch 'poco-1.10.0' of github.com:pocoproject/poco into devel
obiltschnig Jan 23, 2020
26f08dc
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 23, 2020
1b6cef1
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 23, 2020
6cebb80
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 23, 2020
ebf322c
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 24, 2020
0f5acf4
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 24, 2020
44f3792
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 25, 2020
e2c2465
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 25, 2020
cec372c
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 26, 2020
dd0cc83
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 26, 2020
156d31d
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 26, 2020
68230d6
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 26, 2020
80af555
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 26, 2020
1107460
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 27, 2020
bd1c846
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 27, 2020
28c1c20
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 27, 2020
b884f04
Merge branch 'poco-1.10.0' into devel
obiltschnig Jan 27, 2020
611991c
Merge branch 'devel' of github.com:pocoproject/poco into devel
obiltschnig Jan 27, 2020
7bf733d
Merge branch 'master' into devel
obiltschnig Jan 27, 2020
ebc1e16
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
559e52a
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
a516afb
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
69e56a1
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
a5d6f25
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
49959d1
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
87b7052
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 4, 2020
e5d6286
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 5, 2020
a5b1d9a
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 7, 2020
ab3f9dc
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 7, 2020
bc69ddb
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 7, 2020
aec9205
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 8, 2020
bcd6809
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 8, 2020
e28e5a1
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 9, 2020
f4b68ff
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 10, 2020
7424c0a
Rename pcre internal symbols used by Poco to avoid symbol collision
Thomas-Barbier-1A Feb 12, 2020
0326b34
Merge pull request #2921 from Thomas-Barbier-1A/rename_pcre_symbols
obiltschnig Feb 12, 2020
7e8c9bc
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 12, 2020
e795d45
Merge branch 'poco-1.10.1' of github.com:pocoproject/poco into devel
obiltschnig Feb 12, 2020
4e5d460
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 12, 2020
27f24c5
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 14, 2020
6b84d43
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 16, 2020
b9d4933
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 16, 2020
089d3fc
Merge branch 'poco-1.10.1' into devel
obiltschnig Feb 17, 2020
047910b
Fix warning in clang
linquize Feb 16, 2020
8e2036f
Fix MSVC clang build fail
linquize Feb 16, 2020
76a89e0
Merge pull request #2928 from linquize/clang
obiltschnig Feb 17, 2020
5568c00
Zip and SevenZip do not depend on Util, XML, JSON
linquize Feb 16, 2020
13a89d4
Added Test and new Pattern 'O' to only log the Filename not the full …
Feb 19, 2020
0522bf2
Updated Comment
Feb 19, 2020
7c1bc7e
Merge pull request #2933 from KevDi/feature/SourceFileLoggingPattern
obiltschnig Feb 19, 2020
1811445
Configuration to receive OCSP stapling response for client connection…
patilneelima Feb 20, 2020
e199cc6
removed SDK version from project files
obiltschnig Feb 21, 2020
0c5a059
run Application::initialize() in try-catch block
obiltschnig Feb 24, 2020
0daa88f
fix Invalid condition [ICMPv4PacketImpl.cpp:234] #2783
aleks-f Feb 25, 2020
edc975a
Merge pull request #2935 from p-neels/OCSPStaplingSupportForClientConn
obiltschnig Feb 28, 2020
7ca90cb
style fixes for #2935; check OpenSSL version
obiltschnig Feb 28, 2020
1d16cb1
Fixed issue 2945 (#2946)
akete Mar 3, 2020
5a5e858
NetSSL_Win: fix potential endless loop due to wrong error handling
obiltschnig Mar 13, 2020
95d38c8
fixed GH #2970: Poco::Data::TypeHandler<Poco::Nullable<T>>::prepare()…
obiltschnig Apr 1, 2020
04ff7e5
Fixed linking with Data ODBC error on some platforms
YuriAzathoth Apr 20, 2020
daa729c
Merge pull request #2929 from linquize/zip
obiltschnig May 5, 2020
8d632db
Fix set padding call for new versions of OpenSSL
bytedreamer May 11, 2020
bc9f15e
Merge pull request #2995 from bytedreamer/bytedreamer-patch-1
obiltschnig May 12, 2020
bb5467a
PatternFormatter priorityNames fix
kitaisreal Jun 2, 2020
29cfff2
PKCS12Container: fix memory leaks on exceptions
agalanin Jun 4, 2020
06142a7
Fix constness of URI::getPathSegments
jabaa Jul 15, 2020
013c867
Merge pull request #3052 from jabaa/devel
obiltschnig Jul 16, 2020
d9252b7
Fix typo in the ThreadPool's docs
Aug 17, 2020
dd0dc49
Changed EventHandlerMap key (#3116)
micheleselea Oct 5, 2020
ff64d51
Fix configuration error while cross compiling (#3127)
fekir Oct 26, 2020
188d1bd
feat(SessionImpl): add dbEncoding property
aleks-f Nov 19, 2020
f9da9a8
fix(ODBCStatementImpl): add dbEncoding parameter to Extractor constru…
aleks-f Nov 19, 2020
cf2d7c7
fix(Extractor): optimize transcoding
aleks-f Nov 20, 2020
84b58db
fix(Extractor): check encoding validity early and make Extractor enco…
aleks-f Nov 20, 2020
a688894
fix(Extractor): clang compile
aleks-f Nov 25, 2020
dd3fcc0
crash when remove key from JSON::Object(JSON_PRESERVE_KEY_ORDER). (#3…
fenghao119 Nov 25, 2020
7380087
#3153: Poco::Data::ODBC [N]VARCHAR(MAX) wrong maxDataSize() result
obiltschnig Nov 27, 2020
3fbf5d2
[SharedPtr] Poco::makeSharedArray #3200
aleks-f Feb 4, 2021
5187f9d
#3202: JWT: ESxxx signature must include padding for ECDSA R and S va…
obiltschnig Feb 6, 2021
cb6e801
merge changes from 1.10.2
obiltschnig Apr 11, 2021
ad2eea5
formatting
obiltschnig Apr 11, 2021
a7ef9d7
merge JSON formatting changes from 1.10.2
obiltschnig Apr 11, 2021
5c0852b
added Application::windowSize()
obiltschnig Apr 11, 2021
d1f72c6
RemoteSyslogChannel/RemoteSyslogListener: make UDP buffer size config…
obiltschnig Apr 11, 2021
9906cf4
merge fix from 1.10.2
obiltschnig Apr 11, 2021
49cd302
merge Postgres fixes from 1.10.2
obiltschnig Apr 11, 2021
f46cf3a
#2993: The Sec-WebSocket-Key of WebSocket is always the same one
obiltschnig Apr 11, 2021
ddd8bf1
Merge pull request #3021 from kitaisreal/pattern-formatter-priority-n…
obiltschnig Apr 11, 2021
0574043
formatting
obiltschnig Apr 11, 2021
a9b4fac
#2927
obiltschnig Apr 11, 2021
7b610ec
remove HowToGetHelp page due to outdated information
obiltschnig Apr 11, 2021
7d29ed1
Merge pull request #3027 from agalanin/devel
obiltschnig Apr 11, 2021
98d2ad1
formatting
obiltschnig Apr 11, 2021
8722e0e
#3044: Upgrade PCRE to 8.44
obiltschnig Apr 11, 2021
b4d15d4
#3086: Use POCO_IOS_INIT_HACK for Linux in combination with libc++
obiltschnig Apr 12, 2021
904236e
#3095: Digest proxy authentication does not work in 1.10.1
obiltschnig Apr 12, 2021
eb992c9
#3136: Fixed null character issue when parsing a JSON
obiltschnig Apr 12, 2021
95214e4
#3114: Added JSON Array::empty() method
obiltschnig Apr 12, 2021
2f20e26
#3230: ECDSADigestEngine: include missing header
obiltschnig Apr 12, 2021
44e8882
Merge pull request #3078 from creazero/fix-demans-typo-in-threadpool-…
obiltschnig Apr 14, 2021
68124e4
Merge pull request #2984 from YuriAzathoth/data-odbc-fix
obiltschnig Apr 16, 2021
6243603
fix include order
obiltschnig Apr 16, 2021
f810bd0
include order
obiltschnig Apr 16, 2021
a637678
Merge branch 'devel' into feat/data-db-encoding
aleks-f Jun 20, 2021
729fec5
feat(Data): merge feat/data-db-encoding
aleks-f Jun 20, 2021
610e667
fix(PollSet): disable PollSet no conection tests on windows (broken W…
aleks-f Jun 20, 2021
9b0618a
chore(Context): align with 1.11.0
aleks-f Jun 20, 2021
80a33ad
chore(NetSSL): sync with 1.11.0
aleks-f Jun 20, 2021
7c75c90
chore: sync with 1.11.0
aleks-f Jun 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions Data/ODBC/include/Poco/Data/ODBC/Extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "Poco/Dynamic/Var.h"
#include "Poco/Nullable.h"
#include "Poco/UTFString.h"
#include "Poco/TextEncoding.h"
#include "Poco/TextConverter.h"
#include "Poco/Exception.h"
#include <map>
#ifdef POCO_OS_FAMILY_WINDOWS
Expand All @@ -52,8 +54,9 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
public:
typedef Preparator::Ptr PreparatorPtr;

Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator);
Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator,
Poco::TextEncoding::Ptr pDBEncoding = nullptr);
/// Creates the Extractor.

~Extractor();
Expand Down Expand Up @@ -580,6 +583,40 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
return false;
}

template <typename C>
bool stringContainerExtractConvert(std::size_t pos, C& val)
{
bool ret = false;
C res;
ret = extractBoundImplContainer(pos, res);
val.clear();
if (ret)
{
Poco::TextConverter conv(*_pDBEncoding, *_pToEncoding);
val.resize(res.size());
typename C::iterator vIt = val.begin();
typename C::iterator it = res.begin();
for (; it != res.end(); ++it, ++vIt) conv.convert(*it, *vIt);
}
return ret;
}

template <typename C>
bool stringContainerExtract(std::size_t pos, C& val)
{
bool ret = false;
if (Preparator::DE_BOUND == _dataExtraction)
{
if (!_transcode)
ret = extractBoundImplContainer(pos, val);
else
ret = stringContainerExtractConvert(pos, val);
}
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
return ret;
}

bool isNullLengthIndicator(SQLLEN val) const;
/// The reason for this utility wrapper are platforms where
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
Expand All @@ -591,6 +628,9 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
PreparatorPtr _pPreparator;
Preparator::DataExtraction _dataExtraction;
std::vector<SQLLEN> _lengths;
Poco::TextEncoding::Ptr _pDBEncoding;
bool _transcode;
Poco::TextEncoding::Ptr _pToEncoding;
};


Expand Down
2 changes: 0 additions & 2 deletions Data/ODBC/include/Poco/Data/ODBC/ODBCStatementImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ class ODBC_API ODBCStatementImpl: public Poco::Data::StatementImpl
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
/// behavior for PB_AT_EXEC binding mode.

void getData();

void addPreparator();
void fillColumns();
void checkError(SQLRETURN rc, const std::string& msg="");
Expand Down
24 changes: 24 additions & 0 deletions Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Poco/Data/ODBC/Handle.h"
#include "Poco/Data/ODBC/ODBCException.h"
#include "Poco/Data/AbstractSessionImpl.h"
#include "Poco/TextEncoding.h"
#include "Poco/SharedPtr.h"
#include "Poco/Mutex.h"
#ifdef POCO_OS_FAMILY_WINDOWS
Expand Down Expand Up @@ -162,6 +163,16 @@ class ODBC_API SessionImpl: public Poco::Data::AbstractSessionImpl<SessionImpl>
/// Returns the timeout (in seconds) for queries,
/// or -1 if no timeout has been set.

void setDBEncoding(const std::string&, const Poco::Any& value);
/// Sets the database encoding.
/// Value must be of type std::string.

Poco::Any getDBEncoding(const std::string&) const;
/// Returns the database encoding.

const std::string& dbEncoding() const;
/// Returns the database encoding.

const ConnectionHandle& dbc() const;
/// Returns the connection handle.

Expand Down Expand Up @@ -193,6 +204,7 @@ class ODBC_API SessionImpl: public Poco::Data::AbstractSessionImpl<SessionImpl>
mutable char _canTransact;
bool _inTransaction;
int _queryTimeout;
std::string _dbEncoding;
Poco::FastMutex _mutex;
};

Expand Down Expand Up @@ -291,6 +303,18 @@ inline int SessionImpl::queryTimeout() const
}


inline Poco::Any SessionImpl::getDBEncoding(const std::string&) const
{
return _dbEncoding;
}


inline const std::string& SessionImpl::dbEncoding() const
{
return _dbEncoding;
}


} } } // namespace Poco::Data::ODBC


Expand Down
49 changes: 30 additions & 19 deletions Data/ODBC/src/Extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "Poco/Data/ODBC/ODBCException.h"
#include "Poco/Data/LOB.h"
#include "Poco/Buffer.h"
#include "Poco/Exception.h"
#include <typeinfo>


Expand All @@ -34,11 +33,15 @@ const std::string Extractor::FLD_SIZE_EXCEEDED_FMT = "Specified data size (%z by
"to increase the maximum allowed data size\n";


Extractor::Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator):
Extractor::Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator,
TextEncoding::Ptr pDBEncoding):
_rStmt(rStmt),
_pPreparator(pPreparator),
_dataExtraction(pPreparator->getDataExtraction())
_dataExtraction(pPreparator->getDataExtraction()),
_pDBEncoding(pDBEncoding),
_transcode(_pDBEncoding && !_pDBEncoding->isA("UTF-8")),
_pToEncoding(_transcode ? Poco::TextEncoding::find("UTF-8") : nullptr)
{
}

Expand Down Expand Up @@ -702,37 +705,45 @@ bool Extractor::extract(std::size_t pos, std::list<double>& val)

bool Extractor::extract(std::size_t pos, std::string& val)
{
if (Preparator::DE_MANUAL == _dataExtraction)
return extractManualImpl(pos, val, SQL_C_CHAR);
bool ret = false;

if (!_transcode)
{
if (Preparator::DE_MANUAL == _dataExtraction)
ret = extractManualImpl(pos, val, SQL_C_CHAR);
else
ret = extractBoundImpl(pos, val);
}
else
return extractBoundImpl(pos, val);
{
std::string result;
if (Preparator::DE_MANUAL == _dataExtraction)
ret = extractManualImpl(pos, result, SQL_C_CHAR);
else
ret = extractBoundImpl(pos, result);
Poco::TextConverter converter(*_pDBEncoding, *_pToEncoding);
converter.convert(result, val);
}

return ret;
}


bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
return stringContainerExtract(pos, val);
}


bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
return stringContainerExtract(pos, val);
}


bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
{
if (Preparator::DE_BOUND == _dataExtraction)
return extractBoundImplContainer(pos, val);
else
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
return stringContainerExtract(pos, val);
}


Expand Down
3 changes: 2 additions & 1 deletion Data/ODBC/src/ODBCStatementImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ void ODBCStatementImpl::addPreparator()
else
_preparations.push_back(new Preparator(*_preparations[0]));

_extractors.push_back(new Extractor(_stmt, _preparations.back()));
_extractors.push_back(new Extractor(_stmt, _preparations.back(),
TextEncoding::find(Poco::RefAnyCast<std::string>(session().getProperty("dbEncoding")))));
}


Expand Down
18 changes: 16 additions & 2 deletions Data/ODBC/src/SessionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ SessionImpl::SessionImpl(const std::string& connect,
_autoExtract(autoExtract),
_canTransact(ODBC_TXN_CAPABILITY_UNKNOWN),
_inTransaction(false),
_queryTimeout(-1)
_queryTimeout(-1),
_dbEncoding("UTF-8")
{
setFeature("bulk", true);
open();
Expand All @@ -58,7 +59,8 @@ SessionImpl::SessionImpl(const std::string& connect,
_autoExtract(autoExtract),
_canTransact(ODBC_TXN_CAPABILITY_UNKNOWN),
_inTransaction(false),
_queryTimeout(-1)
_queryTimeout(-1),
_dbEncoding("UTF-8")
{
setFeature("bulk", true);
open();
Expand Down Expand Up @@ -158,12 +160,24 @@ void SessionImpl::open(const std::string& connect)
&SessionImpl::setQueryTimeout,
&SessionImpl::getQueryTimeout);

addProperty("dbEncoding",
&SessionImpl::setDBEncoding,
&SessionImpl::getDBEncoding);

Poco::Data::ODBC::SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, 0, 0);

if (!canTransact()) autoCommit("", true);
}


void SessionImpl::setDBEncoding(const std::string&, const Poco::Any& value)
{
const std::string& enc = Poco::RefAnyCast<std::string>(value);
Poco::TextEncoding::byName(enc); // throws if not found
_dbEncoding = enc;
}


bool SessionImpl::isConnected() const
{
SQLULEN value = 0;
Expand Down
43 changes: 43 additions & 0 deletions Data/SQLite/testsuite/src/SQLiteTest.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ using Poco::Data::SQLChannel;
using Poco::Data::LimitException;
using Poco::Data::ConnectionFailedException;
using Poco::Data::CLOB;
using Poco::Data::BLOB;
using Poco::Data::Date;
using Poco::Data::Time;
using Poco::Data::Transaction;
Expand Down Expand Up @@ -1419,6 +1420,47 @@ void SQLiteTest::testCLOB()
}


void SQLiteTest::testBLOB()
{
std::string lastName("lastname");
std::string firstName("firstname");
std::string address("Address");
Session tmp(Poco::Data::SQLite::Connector::KEY, "dummy.db");
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
typedef struct
{
int i = 0;
Poco::Int64 i64 = 1;
float f = 2.5;
double d = 3.5;
char c[16] = {0};
} DataStruct;
DataStruct ds;
strcpy(ds.c, "123456789ABCDEF");
BLOB img(reinterpret_cast<unsigned char*>(&ds), sizeof(ds));
assertTrue(img.size() == sizeof(ds));
int count = 0;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :img)", use(lastName), use(firstName), use(address), use(img), now;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assertTrue(count == 1);
BLOB res;
assertTrue(res.size() == 0);

tmp << "SELECT Image FROM Person WHERE LastName == :ln", bind("lastname"), into(res), now;
assertTrue(res.size() == img.size());
assertTrue(0 == std::memcmp(res.rawContent(), img.rawContent(), sizeof(img)));
assertTrue(0 == std::memcmp(res.rawContent(), &ds, sizeof(ds)));
DataStruct dsCopy;
std::memcpy(&dsCopy, res.rawContent(), sizeof(dsCopy));
assertTrue(ds.i == dsCopy.i);
assertTrue(ds.i64 == dsCopy.i64);
assertTrue(ds.f == dsCopy.f);
assertTrue(ds.d == dsCopy.d);
assertTrue(std::string(ds.c) == std::string(dsCopy.c));
}


void SQLiteTest::testTuple10()
{
Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
Expand Down Expand Up @@ -3448,6 +3490,7 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testSingleSelect);
CppUnit_addTest(pSuite, SQLiteTest, testEmptyDB);
CppUnit_addTest(pSuite, SQLiteTest, testCLOB);
CppUnit_addTest(pSuite, SQLiteTest, testBLOB);
CppUnit_addTest(pSuite, SQLiteTest, testTuple10);
CppUnit_addTest(pSuite, SQLiteTest, testTupleVector10);
CppUnit_addTest(pSuite, SQLiteTest, testTuple9);
Expand Down
1 change: 1 addition & 0 deletions Data/SQLite/testsuite/src/SQLiteTest.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class SQLiteTest: public CppUnit::TestCase
void testEmptyDB();

void testCLOB();
void testBLOB();

void testTuple1();
void testTupleVector1();
Expand Down
4 changes: 2 additions & 2 deletions Data/src/SimpleRowFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::string& SimpleRowFormatter::formatNames(const NameVecPtr pNames, std::strin

std::ostringstream str;
std::string line(std::string::size_type(pNames->size()*_colWidth + (pNames->size() - 1)*_spacing), '-');
std::string space(_spacing, ' ');
std::string space(static_cast<std::size_t>(_spacing), ' ');
NameVec::const_iterator it = pNames->begin();
NameVec::const_iterator end = pNames->end();
for (; it != end; ++it)
Expand All @@ -83,7 +83,7 @@ std::string& SimpleRowFormatter::formatNames(const NameVecPtr pNames, std::strin
std::string& SimpleRowFormatter::formatValues(const ValueVec& vals, std::string& formattedValues)
{
std::ostringstream str;
std::string space(_spacing, ' ');
std::string space(static_cast<std::size_t>(_spacing), ' ');
ValueVec::const_iterator it = vals.begin();
ValueVec::const_iterator end = vals.end();
for (; it != end; ++it)
Expand Down
2 changes: 1 addition & 1 deletion Foundation/Foundation_vs160.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<ProjectGuid>{B01196CC-B693-4548-8464-2FF60499E73F}</ProjectGuid>
<RootNamespace>Foundation</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
Expand Down
2 changes: 1 addition & 1 deletion Foundation/include/Poco/AbstractObserver.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Foundation_API AbstractObserver

virtual void notify(Notification* pNf) const = 0;
virtual bool equals(const AbstractObserver& observer) const = 0;
virtual bool accepts(Notification* pNf) const = 0;
virtual bool accepts(Notification* pNf, const char* pName = 0) const = 0;
virtual AbstractObserver* clone() const = 0;
virtual void disable() = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions Foundation/include/Poco/NObserver.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class NObserver: public AbstractObserver
return pObs && pObs->_pObject == _pObject && pObs->_method == _method;
}

bool accepts(Notification* pNf) const
bool accepts(Notification* pNf, const char* pName = 0) const
{
return dynamic_cast<N*>(pNf) != 0;
return dynamic_cast<N*>(pNf) && (!pName || pNf->name() == pName);
}

AbstractObserver* clone() const
Expand Down
Loading