From 0081bde0848a74c6014449c2072d6e12e3e74818 Mon Sep 17 00:00:00 2001 From: Hernan Martinez Date: Thu, 26 May 2022 10:36:45 -0400 Subject: [PATCH] Use transaction_isolation in MySQL 8+ (#3490) * Use transaction_isolation in MySQL 8+ * Trim buffer before comparison --- Data/MySQL/src/SessionImpl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Data/MySQL/src/SessionImpl.cpp b/Data/MySQL/src/SessionImpl.cpp index 3a2c865fc..998fa5c6b 100644 --- a/Data/MySQL/src/SessionImpl.cpp +++ b/Data/MySQL/src/SessionImpl.cpp @@ -14,6 +14,7 @@ #include "Poco/Data/MySQL/SessionImpl.h" #include "Poco/Data/MySQL/MySQLStatementImpl.h" +#include "Poco/Data/MySQL/Utility.h" #include "Poco/Data/Session.h" #include "Poco/NumberParser.h" #include "Poco/String.h" @@ -255,7 +256,16 @@ void SessionImpl::setTransactionIsolation(Poco::UInt32 ti) Poco::UInt32 SessionImpl::getTransactionIsolation() const { std::string isolation; - getSetting("tx_isolation", isolation); + unsigned long version = Utility::serverVersion(_handle); + if (version >= 80000) + { + getSetting("transaction_isolation", isolation); + isolation = isolation.c_str(); + } + else + { + getSetting("tx_isolation", isolation); + } Poco::replaceInPlace(isolation, "-", " "); if (MYSQL_READ_UNCOMMITTED == isolation) return Session::TRANSACTION_READ_UNCOMMITTED;