Skip to content

Commit 6e380b6

Browse files
committed
Various feature additions and fixes:
- asynchronous execution for Data::Statement - ActiveMethod copy and assignment - added Data components to $POCO_BASE/components - SQLite 64-bit integer default - SessionPool timer seconds to milliseconds - ODBC fix for subsequent calls to execute() - std::deque (instead of std::vector) as default container
1 parent 0dfd7be commit 6e380b6

34 files changed

Lines changed: 597 additions & 115 deletions

‎Data/ODBC/src/Binder.cpp‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,21 @@ SQLSMALLINT Binder::toODBCDirection(Direction dir) const
300300

301301
void Binder::synchronize()
302302
{
303-
TimestampMap::iterator itTS = _timestamps.begin();
304-
TimestampMap::iterator itTSEnd = _timestamps.end();
305-
for(; itTS != itTSEnd; ++itTS)
306-
Utility::dateTimeSync(*itTS->second, *itTS->first);
303+
if (_timestamps.size())
304+
{
305+
TimestampMap::iterator itTS = _timestamps.begin();
306+
TimestampMap::iterator itTSEnd = _timestamps.end();
307+
for(; itTS != itTSEnd; ++itTS)
308+
Utility::dateTimeSync(*itTS->second, *itTS->first);
309+
}
307310

308-
StringMap::iterator itStr = _strings.begin();
309-
StringMap::iterator itStrEnd = _strings.end();
310-
for(; itStr != itStrEnd; ++itStr)
311-
itStr->second->assign(itStr->first, strlen(itStr->first));
311+
if (_strings.size())
312+
{
313+
StringMap::iterator itStr = _strings.begin();
314+
StringMap::iterator itStrEnd = _strings.end();
315+
for(; itStr != itStrEnd; ++itStr)
316+
itStr->second->assign(itStr->first, strlen(itStr->first));
317+
}
312318
}
313319

314320

‎Data/ODBC/src/ODBCStatementImpl.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ void ODBCStatementImpl::putData()
212212
void ODBCStatementImpl::clear()
213213
{
214214
SQLRETURN rc = SQLCloseCursor(_stmt);
215+
_stepCalled = false;
215216
if (Utility::isError(rc))
216217
{
217218
StatementError err(_stmt);

‎Data/ODBC/testsuite/src/ODBCDB2Test.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,21 @@ void ODBCDB2Test::testRowIterator()
10671067
}
10681068

10691069

1070+
void ODBCDB2Test::testAsync()
1071+
{
1072+
if (!_pSession) fail ("Test not available.");
1073+
1074+
for (int i = 0; i < 8;)
1075+
{
1076+
recreateIntsTable();
1077+
_pSession->setFeature("autoBind", bindValues[i]);
1078+
_pSession->setFeature("autoExtract", bindValues[i+1]);
1079+
_pExecutor->asynchronous();
1080+
i += 2;
1081+
}
1082+
}
1083+
1084+
10701085
void ODBCDB2Test::dropObject(const std::string& type, const std::string& name)
10711086
{
10721087
try
@@ -1322,6 +1337,7 @@ CppUnit::Test* ODBCDB2Test::suite()
13221337
CppUnit_addTest(pSuite, ODBCDB2Test, testStoredFunction);
13231338
CppUnit_addTest(pSuite, ODBCDB2Test, testNull);
13241339
CppUnit_addTest(pSuite, ODBCDB2Test, testRowIterator);
1340+
CppUnit_addTest(pSuite, ODBCDB2Test, testAsync);
13251341

13261342
return pSuite;
13271343
}

‎Data/ODBC/testsuite/src/ODBCDB2Test.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class ODBCDB2Test: public CppUnit::TestCase
125125
void testNull();
126126
void testRowIterator();
127127

128+
void testAsync();
129+
128130
void setUp();
129131
void tearDown();
130132

‎Data/ODBC/testsuite/src/ODBCMySQLTest.cpp‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,21 @@ void ODBCMySQLTest::testRowIterator()
931931
}
932932

933933

934+
void ODBCMySQLTest::testAsync()
935+
{
936+
if (!_pSession) fail ("Test not available.");
937+
938+
for (int i = 0; i < 8;)
939+
{
940+
recreateIntsTable();
941+
_pSession->setFeature("autoBind", bindValues[i]);
942+
_pSession->setFeature("autoExtract", bindValues[i+1]);
943+
_pExecutor->asynchronous();
944+
i += 2;
945+
}
946+
}
947+
948+
934949
void ODBCMySQLTest::dropObject(const std::string& type, const std::string& name)
935950
{
936951
*_pSession << format("DROP %s IF EXISTS %s", type, name), now;
@@ -1169,6 +1184,8 @@ CppUnit::Test* ODBCMySQLTest::suite()
11691184
CppUnit_addTest(pSuite, ODBCMySQLTest, testInternalStorageType);
11701185
CppUnit_addTest(pSuite, ODBCMySQLTest, testNull);
11711186
CppUnit_addTest(pSuite, ODBCMySQLTest, testRowIterator);
1187+
CppUnit_addTest(pSuite, ODBCMySQLTest, testAsync);
1188+
11721189
return pSuite;
11731190
}
11741191

‎Data/ODBC/testsuite/src/ODBCMySQLTest.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ class ODBCMySQLTest: public CppUnit::TestCase
127127
void testNull();
128128
void testRowIterator();
129129

130+
void testAsync();
131+
130132
void setUp();
131133
void tearDown();
132134

‎Data/ODBC/testsuite/src/ODBCOracleTest.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,21 @@ void ODBCOracleTest::testRowIterator()
10821082
}
10831083

10841084

1085+
void ODBCOracleTest::testAsync()
1086+
{
1087+
if (!_pSession) fail ("Test not available.");
1088+
1089+
for (int i = 0; i < 8;)
1090+
{
1091+
recreateIntsTable();
1092+
_pSession->setFeature("autoBind", bindValues[i]);
1093+
_pSession->setFeature("autoExtract", bindValues[i+1]);
1094+
_pExecutor->asynchronous();
1095+
i += 2;
1096+
}
1097+
}
1098+
1099+
10851100
void ODBCOracleTest::dropObject(const std::string& type, const std::string& name)
10861101
{
10871102
try
@@ -1369,6 +1384,7 @@ CppUnit::Test* ODBCOracleTest::suite()
13691384
CppUnit_addTest(pSuite, ODBCOracleTest, testInternalStorageType);
13701385
CppUnit_addTest(pSuite, ODBCOracleTest, testNull);
13711386
CppUnit_addTest(pSuite, ODBCOracleTest, testRowIterator);
1387+
CppUnit_addTest(pSuite, ODBCOracleTest, testAsync);
13721388

13731389
return pSuite;
13741390
}

‎Data/ODBC/testsuite/src/ODBCOracleTest.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class ODBCOracleTest: public CppUnit::TestCase
125125
void testNull();
126126
void testRowIterator();
127127

128+
void testAsync();
129+
128130
void setUp();
129131
void tearDown();
130132

‎Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,21 @@ void ODBCPostgreSQLTest::testStdVectorBool()
994994
}
995995

996996

997+
void ODBCPostgreSQLTest::testAsync()
998+
{
999+
if (!_pSession) fail ("Test not available.");
1000+
1001+
for (int i = 0; i < 8;)
1002+
{
1003+
recreateIntsTable();
1004+
_pSession->setFeature("autoBind", bindValues[i]);
1005+
_pSession->setFeature("autoExtract", bindValues[i+1]);
1006+
_pExecutor->asynchronous();
1007+
i += 2;
1008+
}
1009+
}
1010+
1011+
9971012
void ODBCPostgreSQLTest::configurePLPgSQL()
9981013
{
9991014
if (!_pSession) fail ("Test not available.");
@@ -1317,6 +1332,7 @@ CppUnit::Test* ODBCPostgreSQLTest::suite()
13171332
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testNull);
13181333
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testRowIterator);
13191334
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testStdVectorBool);
1335+
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testAsync);
13201336

13211337
return pSuite;
13221338
}

‎Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class ODBCPostgreSQLTest: public CppUnit::TestCase
133133
void testRowIterator();
134134
void testStdVectorBool();
135135

136+
void testAsync();
137+
136138
void setUp();
137139
void tearDown();
138140

0 commit comments

Comments
 (0)