[SF 2580108] Improve transaction handling

This commit is contained in:
Aleksandar Fabijanic
2009-02-08 23:14:54 +00:00
parent ad543acb58
commit d11f007d23
41 changed files with 3484 additions and 2142 deletions

View File

@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include"
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include;..\..\MySQL\include\Poco\Data\MySQL\mysql"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@@ -79,27 +79,6 @@ MySQLTest::MySQLTest(const std::string& name):
CppUnit::TestCase(name)
{
MySQL::Connector::registerConnector();
/*static bool beenHere = false;
if (!beenHere)
{
try
{
_pSession = new Session(SessionFactory::instance().create(MySQL::Connector::KEY, _dbConnString));
}catch (ConnectionException& ex)
{
std::cout << "!!! WARNING: Connection failed. MySQL tests will fail !!!" << std::endl;
std::cout << ex.toString() << std::endl;
}
if (_pSession && _pSession->isConnected())
std::cout << "*** Connected to " << '(' << _dbConnString << ')' << std::endl;
if (!_pExecutor) _pExecutor = new SQLExecutor("MySQL SQL Executor", _pSession);
}
beenHere = true;*/
}
@@ -510,6 +489,24 @@ void MySQLTest::testNull()
}
void MySQLTest::testSessionTransaction()
{
if (!_pSession) fail ("Test not available.");
recreatePersonBLOBTable();
_pExecutor->sessionTransaction(_dbConnString);
}
void MySQLTest::testTransaction()
{
if (!_pSession) fail ("Test not available.");
recreatePersonBLOBTable();
_pExecutor->transaction(_dbConnString);
}
void MySQLTest::testNullableInt()
{
if (!_pSession) fail ("Test not available.");
@@ -814,6 +811,8 @@ CppUnit::Test* MySQLTest::suite()
CppUnit_addTest(pSuite, MySQLTest, testNullableInt);
CppUnit_addTest(pSuite, MySQLTest, testNullableString);
CppUnit_addTest(pSuite, MySQLTest, testTupleWithNullable);
CppUnit_addTest(pSuite, MySQLTest, testSessionTransaction);
CppUnit_addTest(pSuite, MySQLTest, testTransaction);
return pSuite;
}

View File

@@ -113,6 +113,9 @@ public:
void testNullableString();
void testTupleWithNullable();
void testSessionTransaction();
void testTransaction();
void setUp();
void tearDown();

File diff suppressed because it is too large Load Diff

View File

@@ -110,7 +110,12 @@ public:
void internalExtraction();
void doNull();
void sessionTransaction(const std::string& connect);
void transaction(const std::string& connect);
private:
void setTransactionIsolation(Poco::Data::Session& session, Poco::UInt32 ti);
Poco::Data::Session* _pSession;
};