see CHANGELOG

- added Poco::istring (case-insensitive string) and Poco::isubstr
(case-insensitive substring search)
- improved SQLite execute() return (affected rows) value
- added SQLite sys.dual (in-memory system table)
- applied SF Patch #120: The ExpireLRUCache does not compile with a
tuple as key on Visual Studio 2010
- fixed SF Bug #599: JSON::Array and JSON::Object size() member can
implicitly lose precision
- fixed SF Bug #602: iterating database table rows not correct if no
data in table
- fixed SF Bug #603: count() is missing in HashMap
- fixed GH #23: JSON::Object::stringify throw BadCastException
- fixed GH #16: NetworkInterface::firstAddress() should not throw on
unconfigured interfaces
- Android compile/build support (by Rangel Reale)
- TypeHandler::prepare() now takes const-reference
This commit is contained in:
aleks-f
2012-12-04 23:33:44 -06:00
parent 1138f439af
commit eaa74307a6
19 changed files with 473 additions and 255 deletions

View File

@@ -193,7 +193,7 @@ public:
pBinder->bind(pos++, obj.getAge(), dir);
}
static void prepare(std::size_t pos, Person& obj, AbstractPreparator* pPrepare)
static void prepare(std::size_t pos, const Person& obj, AbstractPreparator* pPrepare)
{
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
poco_assert_dbg (pPrepare != 0);
@@ -674,6 +674,11 @@ void SQLiteTest::testAffectedRows()
tmp << "DROP TABLE IF EXISTS Strings", now;
tmp << "CREATE TABLE IF NOT EXISTS Strings (str VARCHAR(30))", now;
Statement stmt((tmp << "SELECT * FROM Strings"));
tmp << "SELECT COUNT(*) FROM Strings", into(count), now;
assert (count == 0);
assert (0 == stmt.execute());
Statement stmt1((tmp << "INSERT INTO Strings VALUES(:str)", use(str)));
tmp << "SELECT COUNT(*) FROM Strings", into(count), now;
assert (count == 0);
@@ -1242,6 +1247,12 @@ void SQLiteTest::testCombinedLimits()
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now;
std::string a, b, c;
Statement stmt = (tmp << "SELECT LastName, FirstName, Address FROM Person WHERE Address = 'invalid value'",
into(a), into(b), into(c), limit(1));
assert (!stmt.done() && stmt.execute() == 0);
int count = 0;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 2);
@@ -2543,6 +2554,32 @@ void SQLiteTest::testReconnect()
}
void SQLiteTest::testSystemTable()
{
Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db");
int cnt = -1;
session << "SELECT count(*) FROM sys.dual", into(cnt), now;
assert (0 == cnt);
session << "INSERT INTO sys.dual VALUES ('test')", now;
session << "SELECT count(*) FROM sys.dual", into(cnt), now;
assert (1 == cnt);
session << "DELETE FROM sys.dual", now;
session << "SELECT count(*) FROM sys.dual", into(cnt), now;
assert (0 == cnt);
try
{
session << "DROP TABLE sys.dual", now;
fail ("must throw");
}
catch (InvalidAccessException&) { }
}
void SQLiteTest::setUp()
{
}
@@ -2633,6 +2670,7 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testMultipleResults);
CppUnit_addTest(pSuite, SQLiteTest, testPair);
CppUnit_addTest(pSuite, SQLiteTest, testReconnect);
CppUnit_addTest(pSuite, SQLiteTest, testSystemTable);
return pSuite;
}