mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
Use tx_isolation
when connected to MariaDB regardless of version (#3622)
* Use `tx_isolation` when connected to MariaDB regardless of version * Rename variable * Handle MariaDB server info in the middle of the string
This commit is contained in:
parent
573dcca72a
commit
4051f85139
@ -255,16 +255,28 @@ void SessionImpl::setTransactionIsolation(Poco::UInt32 ti)
|
||||
|
||||
Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
||||
{
|
||||
const std::string MARIADB_SERVERINFO = "MariaDB";
|
||||
|
||||
std::string isolation;
|
||||
std::string serverInfo = Utility::serverInfo(_handle);
|
||||
unsigned long version = Utility::serverVersion(_handle);
|
||||
if (version >= 80000)
|
||||
{
|
||||
getSetting("transaction_isolation", isolation);
|
||||
isolation = isolation.c_str();
|
||||
}
|
||||
else
|
||||
|
||||
if (serverInfo.find(MARIADB_SERVERINFO) != std::string::npos) //MariaDB
|
||||
{
|
||||
getSetting("tx_isolation", isolation);
|
||||
isolation = isolation.c_str();
|
||||
}
|
||||
else //MySQL
|
||||
{
|
||||
if (version >= 80000)
|
||||
{
|
||||
getSetting("transaction_isolation", isolation);
|
||||
isolation = isolation.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
getSetting("tx_isolation", isolation);
|
||||
}
|
||||
}
|
||||
Poco::replaceInPlace(isolation, "-", " ");
|
||||
if (MYSQL_READ_UNCOMMITTED == isolation)
|
||||
|
Loading…
Reference in New Issue
Block a user