summaryrefslogtreecommitdiff
path: root/sql/transaction.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-06-10 11:56:20 +0300
committerMonty <monty@mariadb.org>2020-06-14 19:39:43 +0300
commit7f941c4ef6a1373da3957a19c3b4dec89de31a68 (patch)
tree060081faaacf4a8dc001b1892a0ed2efb8d329d6 /sql/transaction.cc
parent56045ef94a1393849e034d187e2ca5d9fd31ad32 (diff)
downloadmariadb-git-7f941c4ef6a1373da3957a19c3b4dec89de31a68.tar.gz
Fixed bug in trans_check() where on error we gave wrong return value
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r--sql/transaction.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc
index b61fa43e579..421aa1cfc51 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -60,7 +60,14 @@ void trans_reset_one_shot_chistics(THD *thd)
thd->tx_read_only= thd->variables.tx_read_only;
}
-/* Conditions under which the transaction state must not change. */
+
+/*
+ Conditions under which the transaction state must not change
+
+ @result TRUE Transaction can not commit
+ @result FALSE Transaction can commit
+*/
+
static bool trans_check(THD *thd)
{
DBUG_ENTER("trans_check");
@@ -72,8 +79,11 @@ static bool trans_check(THD *thd)
DBUG_ASSERT(thd->transaction->stmt.is_empty());
if (unlikely(thd->in_sub_stmt))
+ {
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
- if (!thd->transaction->xid_state.is_explicit_XA())
+ DBUG_RETURN(TRUE);
+ }
+ if (likely(!thd->transaction->xid_state.is_explicit_XA()))
DBUG_RETURN(FALSE);
thd->transaction->xid_state.er_xaer_rmfail();