summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2005-09-14 10:54:02 +0200
committerunknown <pem@mysql.com>2005-09-14 10:54:02 +0200
commit8c86f8e4bfb7627051f8f231daf8bfa87c4e468a (patch)
treedb9b07109e3ba0edcb810cc5c7115a60015f74a8
parent38c43ecdd3c0c57fbf8bc4e969d79d346a7b6b99 (diff)
downloadmariadb-git-8c86f8e4bfb7627051f8f231daf8bfa87c4e468a.tar.gz
Post-review fix for BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
mysql-test/r/sp.result: Added missing drop table. mysql-test/t/sp.test: Added missing drop table. sql/sp_head.h: Post-review fix for autocommit check in SPs and triggers. sql/sql_yacc.yy: Post-review fix for autocommit check in SPs and triggers.
-rw-r--r--mysql-test/r/sp.result1
-rw-r--r--mysql-test/t/sp.test1
-rw-r--r--sql/sp_head.h3
-rw-r--r--sql/sql_yacc.yy17
4 files changed, 12 insertions, 10 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 0559b45168b..e4259eae6bf 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3323,6 +3323,7 @@ drop function bug12379|
drop procedure bug12379_1|
drop procedure bug12379_2|
drop procedure bug12379_3|
+drop table t3|
drop procedure if exists bug13124|
create procedure bug13124()
begin
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index a1e2bf8aa32..1e78a38c040 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -4161,6 +4161,7 @@ drop function bug12379|
drop procedure bug12379_1|
drop procedure bug12379_2|
drop procedure bug12379_3|
+drop table t3|
#
# Bug #13124 Stored Procedure using SELECT INTO crashes server
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 7c9cf364b17..9888fe74149 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -285,7 +285,8 @@ public:
my_error(ER_SP_NO_RETSET, MYF(0), where);
else if (m_flags & HAS_SET_AUTOCOMMIT_STMT)
my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0));
- return test(m_flags & (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS));
+ return test(m_flags &
+ (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT));
}
private:
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index c163db3c393..3253e1065ff 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -8005,15 +8005,14 @@ internal_variable_name:
if (tmp == &sys_time_zone &&
lex->add_time_zone_tables_to_query_tables(YYTHD))
YYABORT;
- else
- if (spc && tmp == &sys_autocommit)
- {
- /*
- We don't allow setting AUTOCOMMIT from a stored function
- or trigger.
- */
- lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
- }
+ else if (spc && tmp == &sys_autocommit)
+ {
+ /*
+ We don't allow setting AUTOCOMMIT from a stored function
+ or trigger.
+ */
+ lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
+ }
}
else
{