mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
ODBC tests for UUID, updated ActiveRecord projects
This commit is contained in:
@@ -612,6 +612,15 @@ void ODBCSQLServerTest::recreateFloatsTable()
|
||||
}
|
||||
|
||||
|
||||
void ODBCSQLServerTest::recreateUUIDsTable()
|
||||
{
|
||||
dropObject("TABLE", "Strings");
|
||||
try { session() << "CREATE TABLE Strings (str UNIQUEIDENTIFIER)", now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateUUIDsTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateUUIDsTable()"); }
|
||||
}
|
||||
|
||||
|
||||
void ODBCSQLServerTest::recreateTuplesTable()
|
||||
{
|
||||
dropObject("TABLE", "Tuples");
|
||||
@@ -787,6 +796,7 @@ CppUnit::Test* ODBCSQLServerTest::suite()
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testDateTime);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testFloat);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testDouble);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testUUID);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTuple);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTupleVector);
|
||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedure);
|
||||
|
||||
@@ -64,6 +64,7 @@ private:
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateUUIDsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorTable();
|
||||
void recreateVectorsTable();
|
||||
|
||||
@@ -917,6 +917,21 @@ void ODBCTest::testDouble()
|
||||
}
|
||||
|
||||
|
||||
void ODBCTest::testUUID()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
for (int i = 0; i < 8;)
|
||||
{
|
||||
recreateUUIDsTable();
|
||||
_pSession->setFeature("autoBind", bindValue(i));
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->uuids();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ODBCTest::testTuple()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
@@ -113,6 +113,8 @@ public:
|
||||
virtual void testFloat();
|
||||
virtual void testDouble();
|
||||
|
||||
virtual void testUUID();
|
||||
|
||||
virtual void testTuple();
|
||||
virtual void testTupleVector();
|
||||
|
||||
@@ -166,6 +168,7 @@ protected:
|
||||
virtual void recreateStringsTable();
|
||||
virtual void recreateIntsTable();
|
||||
virtual void recreateFloatsTable();
|
||||
virtual void recreateUUIDsTable();
|
||||
virtual void recreateTuplesTable();
|
||||
virtual void recreateVectorsTable();
|
||||
virtual void recreateAnysTable();
|
||||
@@ -317,6 +320,12 @@ inline void ODBCTest::recreateFloatsTable()
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateUUIDsTable()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateUUIDsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateTuplesTable()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateTuplesTable()");
|
||||
|
||||
@@ -1540,6 +1540,29 @@ void SQLExecutor::doubles()
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::uuids()
|
||||
{
|
||||
std::string funct = "uuids()";
|
||||
Poco::UUID data("49cf6461-9b62-4163-9659-5472ef73153d");
|
||||
Poco::UUID ret;
|
||||
|
||||
try { session() << "INSERT INTO Strings VALUES (?)", use(data), 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 { session() << "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); }
|
||||
assertTrue (count == 1);
|
||||
|
||||
try { session() << "SELECT str FROM Strings", into(ret), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assertTrue (ret == data);
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::insertSingleBulkVec()
|
||||
{
|
||||
std::string funct = "insertSingleBulkVec()";
|
||||
|
||||
@@ -469,6 +469,7 @@ public:
|
||||
void time();
|
||||
void floats();
|
||||
void doubles();
|
||||
void uuids();
|
||||
void tuples();
|
||||
void tupleVector();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user