mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
Fixed transaction handling in MySQL test when SQL parser is switched off
This commit is contained in:
parent
137cd32183
commit
a64e6cf2f6
@ -1850,9 +1850,11 @@ void SQLExecutor::sessionTransaction(const std::string& connect)
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assertTrue (0 == count);
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
|
||||
_pSession->begin();
|
||||
if (_pSession->impl()->shouldParse()) {
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
_pSession->begin();
|
||||
}
|
||||
try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
@ -1936,11 +1938,13 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
}
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
|
||||
try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assertTrue (0 == count);
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
if (_pSession->impl()->shouldParse()) {
|
||||
try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assertTrue (0 == count);
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
}
|
||||
|
||||
{
|
||||
Transaction trans((*_pSession));
|
||||
@ -1965,7 +1969,8 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assertTrue (2 == count);
|
||||
|
||||
_pSession->begin();
|
||||
if (_pSession->impl()->shouldParse())
|
||||
_pSession->begin();
|
||||
try { (*_pSession) << "DELETE FROM Person", now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
@ -1988,6 +1993,8 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
sql.push_back(sql1);
|
||||
sql.push_back(sql2);
|
||||
|
||||
assertTrue (!_pSession->isTransaction());
|
||||
|
||||
Transaction trans((*_pSession));
|
||||
|
||||
trans.execute(sql1, false);
|
||||
@ -2038,6 +2045,8 @@ void SQLExecutor::reconnect()
|
||||
int count = 0;
|
||||
std::string result;
|
||||
|
||||
_pSession->setFeature("autoCommit", true);
|
||||
|
||||
try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
|
Loading…
Reference in New Issue
Block a user