From 8baa2f9c3418455d8f967f2286fe3b0d8fc63a19 Mon Sep 17 00:00:00 2001 From: Friedrich Wilckens Date: Fri, 3 Nov 2023 20:15:12 -0700 Subject: [PATCH] Implement MySQL::SessionHandle::startTransaction as submitting the SQL statement 'BEGIN' --- Data/MySQL/src/SessionHandle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/MySQL/src/SessionHandle.cpp b/Data/MySQL/src/SessionHandle.cpp index ba935cdb4..5e9ab21b2 100644 --- a/Data/MySQL/src/SessionHandle.cpp +++ b/Data/MySQL/src/SessionHandle.cpp @@ -153,14 +153,14 @@ void SessionHandle::close() void SessionHandle::startTransaction() { - int rc = mysql_autocommit(_pHandle, false); + int rc = mysql_query(_pHandle, "BEGIN"); if (rc != 0) { // retry if connection lost int err = mysql_errno(_pHandle); if (err == 2006 /* CR_SERVER_GONE_ERROR */ || err == 2013 /* CR_SERVER_LOST */) { - rc = mysql_autocommit(_pHandle, false); + rc = mysql_query(_pHandle, "BEGIN"); } } if (rc != 0) throw TransactionException("Start transaction failed.", _pHandle);