mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-09 05:27:25 +02:00
[SF 2580108] Improve transaction handling
This commit is contained in:
@@ -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"
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
@@ -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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user