summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 2c00d76b0f1..0a9541b9f2c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -3078,6 +3078,13 @@ static bool set_option_autocommit(THD *thd, set_var *var)
if ((org_options & OPTION_NOT_AUTOCOMMIT))
{
/* We changed to auto_commit mode */
+ if (thd->transaction.xid_state.xa_state != XA_NOTR)
+ {
+ thd->options= org_options;
+ my_error(ER_XAER_RMFAIL, MYF(0),
+ xa_state_names[thd->transaction.xid_state.xa_state]);
+ return 1;
+ }
thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;