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:
Hernan Martinez 2022-05-31 09:46:49 -04:00 committed by GitHub
parent 573dcca72a
commit 4051f85139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)