mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 23:12:57 +02: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
|
Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
||||||
{
|
{
|
||||||
|
const std::string MARIADB_SERVERINFO = "MariaDB";
|
||||||
|
|
||||||
std::string isolation;
|
std::string isolation;
|
||||||
|
std::string serverInfo = Utility::serverInfo(_handle);
|
||||||
unsigned long version = Utility::serverVersion(_handle);
|
unsigned long version = Utility::serverVersion(_handle);
|
||||||
if (version >= 80000)
|
|
||||||
{
|
if (serverInfo.find(MARIADB_SERVERINFO) != std::string::npos) //MariaDB
|
||||||
getSetting("transaction_isolation", isolation);
|
|
||||||
isolation = isolation.c_str();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
getSetting("tx_isolation", isolation);
|
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, "-", " ");
|
Poco::replaceInPlace(isolation, "-", " ");
|
||||||
if (MYSQL_READ_UNCOMMITTED == isolation)
|
if (MYSQL_READ_UNCOMMITTED == isolation)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user