mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-30 23:51:34 +02:00
Use transaction_isolation in MySQL 8+ (#3490)
* Use transaction_isolation in MySQL 8+ * Trim buffer before comparison
This commit is contained in:
parent
3d316bd548
commit
0081bde084
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "Poco/Data/MySQL/SessionImpl.h"
|
#include "Poco/Data/MySQL/SessionImpl.h"
|
||||||
#include "Poco/Data/MySQL/MySQLStatementImpl.h"
|
#include "Poco/Data/MySQL/MySQLStatementImpl.h"
|
||||||
|
#include "Poco/Data/MySQL/Utility.h"
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/NumberParser.h"
|
#include "Poco/NumberParser.h"
|
||||||
#include "Poco/String.h"
|
#include "Poco/String.h"
|
||||||
@ -255,7 +256,16 @@ void SessionImpl::setTransactionIsolation(Poco::UInt32 ti)
|
|||||||
Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
||||||
{
|
{
|
||||||
std::string isolation;
|
std::string isolation;
|
||||||
|
unsigned long version = Utility::serverVersion(_handle);
|
||||||
|
if (version >= 80000)
|
||||||
|
{
|
||||||
|
getSetting("transaction_isolation", isolation);
|
||||||
|
isolation = isolation.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
getSetting("tx_isolation", isolation);
|
getSetting("tx_isolation", isolation);
|
||||||
|
}
|
||||||
Poco::replaceInPlace(isolation, "-", " ");
|
Poco::replaceInPlace(isolation, "-", " ");
|
||||||
if (MYSQL_READ_UNCOMMITTED == isolation)
|
if (MYSQL_READ_UNCOMMITTED == isolation)
|
||||||
return Session::TRANSACTION_READ_UNCOMMITTED;
|
return Session::TRANSACTION_READ_UNCOMMITTED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user