ODBC null value support and tests (tested win32 all & Linux PostgreSQL)

This commit is contained in:
Aleksandar Fabijanic
2007-06-21 01:27:48 +00:00
parent 7fac905b65
commit 31860214d3
22 changed files with 531 additions and 102 deletions

View File

@@ -863,6 +863,32 @@ void ODBCMySQLTest::testInternalStorageType()
}
void ODBCMySQLTest::testNull()
{
if (!_pSession) fail ("Test not available.");
// test for NOT NULL violation exception
for (int i = 0; i < 8;)
{
recreateNullsTable("NOT NULL");
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->notNulls("HYT00");
i += 2;
}
// test for null insertion
for (int i = 0; i < 8;)
{
recreateNullsTable();
_pSession->setFeature("autoBind", bindValues[i]);
_pSession->setFeature("autoExtract", bindValues[i+1]);
_pExecutor->nulls();
i += 2;
}
}
void ODBCMySQLTest::testStoredProcedure()
{
//MySQL is currently buggy in this area:
@@ -970,6 +996,18 @@ void ODBCMySQLTest::recreateVectorsTable()
}
void ODBCMySQLTest::recreateNullsTable(const std::string& notNull)
{
dropObject("TABLE", "NullTest");
try { *_pSession << format("CREATE TABLE NullTest (i INTEGER %s, r FLOAT %s, v VARCHAR(30) %s)",
notNull,
notNull,
notNull), now; }
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateNullsTable()"); }
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateNullsTable()"); }
}
bool ODBCMySQLTest::canConnect(const std::string& driver, const std::string& dsn)
{
Utility::DriverMap::iterator itDrv = _drivers.begin();
@@ -1113,6 +1151,7 @@ CppUnit::Test* ODBCMySQLTest::suite()
CppUnit_addTest(pSuite, ODBCMySQLTest, testStoredFunction);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInternalExtraction);
CppUnit_addTest(pSuite, ODBCMySQLTest, testInternalStorageType);
CppUnit_addTest(pSuite, ODBCMySQLTest, testNull);
return pSuite;
}