std::list, std::deque bindings

This commit is contained in:
Aleksandar Fabijanic 2007-05-25 01:57:15 +00:00
parent 033b74643c
commit 956aafbd0b
17 changed files with 1317 additions and 4 deletions

View File

@ -194,6 +194,126 @@ void ODBCDB2Test::testInsertEmptyVector()
}
void ODBCDB2Test::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCDB2Test::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCDB2Test::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCDB2Test::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCDB2Test::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCDB2Test::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCDB2Test::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCDB2Test::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCDB2Test::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -854,6 +974,7 @@ void ODBCDB2Test::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -894,6 +1015,14 @@ CppUnit::Test* ODBCDB2Test::suite()
CppUnit_addTest(pSuite, ODBCDB2Test, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertVector);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCDB2Test, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCDB2Test, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertList);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCDB2Test, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCDB2Test, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertDeque);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCDB2Test, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCDB2Test, testLimit);

View File

@ -60,11 +60,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();

View File

@ -183,6 +183,126 @@ void ODBCMySQLTest::testInsertEmptyVector()
}
void ODBCMySQLTest::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCMySQLTest::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCMySQLTest::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCMySQLTest::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCMySQLTest::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCMySQLTest::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCMySQLTest::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCMySQLTest::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCMySQLTest::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -841,6 +961,7 @@ void ODBCMySQLTest::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -885,6 +1006,14 @@ CppUnit::Test* ODBCMySQLTest::suite()
CppUnit_addTest(pSuite, ODBCMySQLTest, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertVector);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCMySQLTest, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCMySQLTest, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertList);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCMySQLTest, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCMySQLTest, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertDeque);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCMySQLTest, testLimit);

View File

@ -63,11 +63,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();

View File

@ -191,6 +191,126 @@ void ODBCOracleTest::testInsertEmptyVector()
}
void ODBCOracleTest::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCOracleTest::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCOracleTest::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCOracleTest::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCOracleTest::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCOracleTest::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCOracleTest::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCOracleTest::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCOracleTest::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -705,6 +825,12 @@ void ODBCOracleTest::testInternalExtraction()
}
void ODBCOracleTest::testStoredProcedure()
{
//TODO
}
void ODBCOracleTest::dropTable(const std::string& tableName)
{
try
@ -873,6 +999,7 @@ void ODBCOracleTest::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -913,6 +1040,14 @@ CppUnit::Test* ODBCOracleTest::suite()
CppUnit_addTest(pSuite, ODBCOracleTest, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertVector);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCOracleTest, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCOracleTest, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertList);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCOracleTest, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCOracleTest, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertDeque);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCOracleTest, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCOracleTest, testLimit);
@ -945,6 +1080,7 @@ CppUnit::Test* ODBCOracleTest::suite()
CppUnit_addTest(pSuite, ODBCOracleTest, testDouble);
CppUnit_addTest(pSuite, ODBCOracleTest, testTuple);
CppUnit_addTest(pSuite, ODBCOracleTest, testTupleVector);
CppUnit_addTest(pSuite, ODBCOracleTest, testStoredProcedure);
CppUnit_addTest(pSuite, ODBCOracleTest, testInternalExtraction);
return pSuite;

View File

@ -61,11 +61,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();
@ -105,6 +116,7 @@ public:
void testTupleVector();
void testInternalExtraction();
void testStoredProcedure();
void setUp();
void tearDown();

View File

@ -185,6 +185,126 @@ void ODBCPostgreSQLTest::testInsertEmptyVector()
}
void ODBCPostgreSQLTest::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCPostgreSQLTest::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCPostgreSQLTest::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCPostgreSQLTest::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCPostgreSQLTest::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCPostgreSQLTest::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCPostgreSQLTest::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCPostgreSQLTest::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCPostgreSQLTest::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -866,6 +986,7 @@ void ODBCPostgreSQLTest::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -906,6 +1027,14 @@ CppUnit::Test* ODBCPostgreSQLTest::suite()
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertVector);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertList);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertDeque);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testLimit);

View File

@ -63,11 +63,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();

View File

@ -195,6 +195,126 @@ void ODBCSQLServerTest::testInsertEmptyVector()
}
void ODBCSQLServerTest::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCSQLServerTest::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCSQLServerTest::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCSQLServerTest::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCSQLServerTest::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCSQLServerTest::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCSQLServerTest::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCSQLServerTest::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCSQLServerTest::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -863,6 +983,7 @@ void ODBCSQLServerTest::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -907,6 +1028,14 @@ CppUnit::Test* ODBCSQLServerTest::suite()
CppUnit_addTest(pSuite, ODBCSQLServerTest, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertVector);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertList);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertDeque);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCSQLServerTest, testLimit);

View File

@ -63,11 +63,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();

View File

@ -195,6 +195,126 @@ void ODBCSQLiteTest::testInsertEmptyVector()
}
void ODBCSQLiteTest::testSimpleAccessList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessList();
i += 2;
}
}
void ODBCSQLiteTest::testComplexTypeList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeList();
i += 2;
}
}
void ODBCSQLiteTest::testInsertList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertList();
i += 2;
}
}
void ODBCSQLiteTest::testInsertEmptyList()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyList();
i += 2;
}
}
void ODBCSQLiteTest::testSimpleAccessDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->simpleAccessDeque();
i += 2;
}
}
void ODBCSQLiteTest::testComplexTypeDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreatePersonTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->complexTypeDeque();
i += 2;
}
}
void ODBCSQLiteTest::testInsertDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertDeque();
i += 2;
}
}
void ODBCSQLiteTest::testInsertEmptyDeque()
{
if (!_pSession) fail ("Test not available.");
for (int i = 0; i < 8;)
{
recreateStringsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->insertEmptyDeque();
i += 2;
}
}
void ODBCSQLiteTest::testInsertSingleBulk()
{
if (!_pSession) fail ("Test not available.");
@ -827,6 +947,7 @@ void ODBCSQLiteTest::tearDown()
{
dropTable("Person");
dropTable("Strings");
dropTable("Tuples");
}
@ -867,6 +988,14 @@ CppUnit::Test* ODBCSQLiteTest::suite()
CppUnit_addTest(pSuite, ODBCSQLiteTest, testComplexTypeVector);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertVector);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertEmptyVector);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testSimpleAccessList);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testComplexTypeList);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertList);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertEmptyList);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testSimpleAccessDeque);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testComplexTypeDeque);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertDeque);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertEmptyDeque);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertSingleBulk);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testInsertSingleBulkVec);
CppUnit_addTest(pSuite, ODBCSQLiteTest, testLimit);

View File

@ -60,11 +60,22 @@ public:
void testSimpleAccess();
void testComplexType();
void testSimpleAccessVector();
void testComplexTypeVector();
void testInsertVector();
void testInsertEmptyVector();
void testSimpleAccessList();
void testComplexTypeList();
void testInsertList();
void testInsertEmptyList();
void testSimpleAccessDeque();
void testComplexTypeDeque();
void testInsertDeque();
void testInsertEmptyDeque();
void testInsertSingleBulk();
void testInsertSingleBulkVec();

View File

@ -640,6 +640,238 @@ void SQLExecutor::insertEmptyVector()
}
void SQLExecutor::simpleAccessList()
{
std::string funct = "simpleAccessList()";
std::list<std::string> lastNames;
std::list<std::string> firstNames;
std::list<std::string> addresses;
std::list<int> ages;
std::string tableName("Person");
lastNames.push_back("LN1");
lastNames.push_back("LN2");
firstNames.push_back("FN1");
firstNames.push_back("FN2");
addresses.push_back("ADDR1");
addresses.push_back("ADDR2");
ages.push_back(1);
ages.push_back(2);
int count = 0;
std::string result;
try { *_pSession << "INSERT INTO PERSON VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { *_pSession << "SELECT COUNT(*) FROM PERSON", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 2);
std::list<std::string> lastNamesR;
std::list<std::string> firstNamesR;
std::list<std::string> addressesR;
std::list<int> agesR;
try { *_pSession << "SELECT * FROM PERSON", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (ages == agesR);
assert (lastNames == lastNamesR);
assert (firstNames == firstNamesR);
assert (addresses == addressesR);
}
void SQLExecutor::complexTypeList()
{
std::string funct = "complexTypeList()";
std::list<Person> people;
people.push_back(Person("LN1", "FN1", "ADDR1", 1));
people.push_back(Person("LN2", "FN2", "ADDR2", 2));
try { *_pSession << "INSERT INTO PERSON VALUES (?,?,?,?)", use(people), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
int count = 0;
try { *_pSession << "SELECT COUNT(*) FROM PERSON", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 2);
std::list<Person> result;
try { *_pSession << "SELECT * FROM PERSON", into(result), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (result == people);
}
void SQLExecutor::insertList()
{
std::string funct = "insertList()";
std::list<std::string> str;
str.push_back("s1");
str.push_back("s2");
str.push_back("s3");
str.push_back("s3");
int count = 100;
{
Statement stmt((*_pSession << "INSERT INTO Strings VALUES (?)", use(str)));
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 0);
try { stmt.execute(); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 4);
}
count = 0;
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 4);
}
void SQLExecutor::insertEmptyList()
{
std::string funct = "insertEmptyList()";
std::list<std::string> str;
try
{
*_pSession << "INSERT INTO Strings VALUES (?)", use(str), now;
fail("empty collections should not work");
}
catch (Poco::Exception&)
{
}
}
void SQLExecutor::simpleAccessDeque()
{
std::string funct = "simpleAccessDeque()";
std::deque<std::string> lastNames;
std::deque<std::string> firstNames;
std::deque<std::string> addresses;
std::deque<int> ages;
std::string tableName("Person");
lastNames.push_back("LN1");
lastNames.push_back("LN2");
firstNames.push_back("FN1");
firstNames.push_back("FN2");
addresses.push_back("ADDR1");
addresses.push_back("ADDR2");
ages.push_back(1);
ages.push_back(2);
int count = 0;
std::string result;
try { *_pSession << "INSERT INTO PERSON VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { *_pSession << "SELECT COUNT(*) FROM PERSON", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 2);
std::deque<std::string> lastNamesR;
std::deque<std::string> firstNamesR;
std::deque<std::string> addressesR;
std::deque<int> agesR;
try { *_pSession << "SELECT * FROM PERSON", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (ages == agesR);
assert (lastNames == lastNamesR);
assert (firstNames == firstNamesR);
assert (addresses == addressesR);
}
void SQLExecutor::complexTypeDeque()
{
std::string funct = "complexTypeDeque()";
std::deque<Person> people;
people.push_back(Person("LN1", "FN1", "ADDR1", 1));
people.push_back(Person("LN2", "FN2", "ADDR2", 2));
try { *_pSession << "INSERT INTO PERSON VALUES (?,?,?,?)", use(people), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
int count = 0;
try { *_pSession << "SELECT COUNT(*) FROM PERSON", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 2);
std::deque<Person> result;
try { *_pSession << "SELECT * FROM PERSON", into(result), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (result == people);
}
void SQLExecutor::insertDeque()
{
std::string funct = "insertDeque()";
std::deque<std::string> str;
str.push_back("s1");
str.push_back("s2");
str.push_back("s3");
str.push_back("s3");
int count = 100;
{
Statement stmt((*_pSession << "INSERT INTO Strings VALUES (?)", use(str)));
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 0);
try { stmt.execute(); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 4);
}
count = 0;
try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
assert (count == 4);
}
void SQLExecutor::insertEmptyDeque()
{
std::string funct = "insertEmptyDeque()";
std::deque<std::string> str;
try
{
*_pSession << "INSERT INTO Strings VALUES (?)", use(str), now;
fail("empty collections should not work");
}
catch (Poco::Exception&)
{
}
}
void SQLExecutor::insertSingleBulk()
{
std::string funct = "insertSingleBulk()";

View File

@ -72,11 +72,22 @@ public:
void simpleAccess();
void complexType();
void simpleAccessVector();
void complexTypeVector();
void insertVector();
void insertEmptyVector();
void simpleAccessList();
void complexTypeList();
void insertList();
void insertEmptyList();
void simpleAccessDeque();
void complexTypeDeque();
void insertDeque();
void insertEmptyDeque();
void insertSingleBulk();
void insertSingleBulkVec();

View File

@ -44,8 +44,10 @@
#include "Poco/Data/AbstractBinding.h"
#include "Poco/Data/DataException.h"
#include "Poco/Data/TypeHandler.h"
#include <set>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <cstddef>
@ -155,6 +157,112 @@ private:
};
template <class T>
class Binding<std::list<T> >: public AbstractBinding
/// Specialization for std::list.
{
public:
explicit Binding(const std::list<T>& val): _val(val), _begin(val.begin()), _end(val.end())
/// Creates the Binding.
{
if (numOfRowsHandled() == 0)
throw BindingException("It is illegal to bind to an empty data collection");
}
~Binding()
/// Destroys the Binding.
{
}
std::size_t numOfColumnsHandled() const
{
return TypeHandler<T>::size();
}
std::size_t numOfRowsHandled() const
{
return _val.size();
}
bool canBind() const
{
return _begin != _end;
}
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder());
++_begin;
}
void reset()
{
_begin = _val.begin();
_end = _val.end();
}
private:
const std::list<T>& _val;
typename std::list<T>::const_iterator _begin;
typename std::list<T>::const_iterator _end;
};
template <class T>
class Binding<std::deque<T> >: public AbstractBinding
/// Specialization for std::deque.
{
public:
explicit Binding(const std::deque<T>& val): _val(val), _begin(val.begin()), _end(val.end())
/// Creates the Binding.
{
if (numOfRowsHandled() == 0)
throw BindingException("It is illegal to bind to an empty data collection");
}
~Binding()
/// Destroys the Binding.
{
}
std::size_t numOfColumnsHandled() const
{
return TypeHandler<T>::size();
}
std::size_t numOfRowsHandled() const
{
return _val.size();
}
bool canBind() const
{
return _begin != _end;
}
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder());
++_begin;
}
void reset()
{
_begin = _val.begin();
_end = _val.end();
}
private:
const std::deque<T>& _val;
typename std::deque<T>::const_iterator _begin;
typename std::deque<T>::const_iterator _end;
};
template <class T>
class Binding<std::set<T> >: public AbstractBinding
/// Specialization for std::set.

View File

@ -49,6 +49,7 @@
#include <set>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <cstddef>
@ -236,6 +237,66 @@ private:
};
template <class T>
class Extraction<std::deque<T> >: public AbstractExtraction
/// Deque Data Type specialization for extraction of values from a query result set.
{
public:
Extraction(std::deque<T>& result): _rResult(result), _default()
{
}
Extraction(std::deque<T>& result, const T& def): _rResult(result), _default(def)
{
}
virtual ~Extraction()
{
}
std::size_t numOfColumnsHandled() const
{
return TypeHandler<T>::size();
}
std::size_t numOfRowsHandled() const
{
return _rResult.size();
}
std::size_t numOfRowsAllowed() const
{
return getLimit();
}
void extract(std::size_t pos)
{
_rResult.push_back(_default);
TypeHandler<T>::extract(pos, _rResult.back(), _default, getExtractor());
}
virtual void reset()
{
}
AbstractPrepare* createPrepareObject(AbstractPreparation* pPrep, std::size_t pos) const
{
return new Prepare<T>(pPrep, pos, _default);
}
protected:
const std::deque<T>& result() const
{
return _rResult;
}
private:
std::deque<T>& _rResult;
T _default; // copy the default
};
template <class T, class C = std::vector<T> >
class InternalExtraction: public Extraction<C>
/// Container Data Type specialization extension for extraction of values from a query result set.

View File

@ -47,15 +47,14 @@
#include <map>
#include <set>
#include <vector>
#include <list>
#include <deque>
namespace Poco {
namespace Data {
class BLOB;
template<typename T>
class Prepare: public AbstractPrepare
/// Class for calling the appropriate AbstractPreparation method.
@ -110,6 +109,60 @@ private:
};
template<typename T>
class Prepare<std::list<T> >: public AbstractPrepare
/// Class for calling the appropriate AbstractPreparation method.
{
public:
Prepare(AbstractPreparation* pPrepare, std::size_t pos, const T& val): AbstractPrepare(pPrepare), _pos(pos), _val(val)
/// Creates the Prepare.
{
}
~Prepare()
/// Destroys the Prepare.
{
}
void prepare()
/// Prepares data.
{
TypeHandler<T>::prepare(_pos, _val, preparation());
}
private:
std::size_t _pos;
const T& _val;
};
template<typename T>
class Prepare<std::deque<T> >: public AbstractPrepare
/// Class for calling the appropriate AbstractPreparation method.
{
public:
Prepare(AbstractPreparation* pPrepare, std::size_t pos, const T& val): AbstractPrepare(pPrepare), _pos(pos), _val(val)
/// Creates the Prepare.
{
}
~Prepare()
/// Destroys the Prepare.
{
}
void prepare()
/// Prepares data.
{
TypeHandler<T>::prepare(_pos, _val, preparation());
}
private:
std::size_t _pos;
const T& _val;
};
template<typename T>
class Prepare<std::set<T> >: public AbstractPrepare
/// Class for calling the appropriate AbstractPreparation method.