diff --git a/Data/SQLite/testsuite/src/SQLiteTest.cpp b/Data/SQLite/testsuite/src/SQLiteTest.cpp index 43c36d97bb..eb257bf6ea 100755 --- a/Data/SQLite/testsuite/src/SQLiteTest.cpp +++ b/Data/SQLite/testsuite/src/SQLiteTest.cpp @@ -256,7 +256,7 @@ SQLiteTest::~SQLiteTest() void SQLiteTest::testBind() { - int f1 = -1; + std::vector vf1; Session session(Poco::Data::SQLite::Connector::KEY, "dummy.db"); session << "DROP TABLE IF EXISTS test", now; session << "CREATE TABLE test (f1 INTEGER)", now; @@ -265,12 +265,17 @@ void SQLiteTest::testBind() statement << "INSERT INTO test(f1) VALUES(?)"; statement.addBind(Poco::Data::Keywords::bind(1, "f1")); statement.execute(); - session << "SELECT f1 FROM test", into(f1), now; - assertTrue (f1 == 1); + session << "SELECT f1 FROM test", into(vf1), now; + assertTrue (vf1.size() == 1); + assertTrue (vf1[0] == 1); statement.removeBind("f1"); statement.addBind(Poco::Data::Keywords::bind(2, "f1")); statement.execute(); - assertTrue (f1 == 2); + vf1.clear(); + session << "SELECT f1 FROM test", into(vf1), now; + assertTrue (vf1.size() == 2); + assertTrue (vf1[0] == 1); + assertTrue (vf1[1] == 2); } @@ -3501,6 +3506,7 @@ CppUnit::Test* SQLiteTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("SQLiteTest"); + CppUnit_addTest(pSuite, SQLiteTest, testBind); CppUnit_addTest(pSuite, SQLiteTest, testBinding); CppUnit_addTest(pSuite, SQLiteTest, testZeroRows); CppUnit_addTest(pSuite, SQLiteTest, testSimpleAccess); diff --git a/Data/include/Poco/Data/Binding.h b/Data/include/Poco/Data/Binding.h index 9585f85e4a..17b38407cd 100644 --- a/Data/include/Poco/Data/Binding.h +++ b/Data/include/Poco/Data/Binding.h @@ -98,8 +98,7 @@ class Binding: public AbstractBinding { _bound = false; AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); + if (pBinder) pBinder->reset(); } private: @@ -168,12 +167,10 @@ class CopyBinding: public AbstractBinding { _bound = false; AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); + if (pBinder) pBinder->reset(); } private: - //typedef typename TypeWrapper::TYPE ValueType; ValPtr _pVal; bool _bound; }; @@ -230,8 +227,7 @@ class Binding: public AbstractBinding { _bound = false; AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); + if (pBinder) pBinder->reset(); } private: @@ -292,8 +288,7 @@ class CopyBinding: public AbstractBinding { _bound = false; AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); + if (pBinder) pBinder->reset(); } private: