summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorpem@mysql.com <>2005-09-14 09:43:02 +0200
committerpem@mysql.com <>2005-09-14 09:43:02 +0200
commitd825ed1a6bc937cba2b46b8194922a9559c6f45e (patch)
tree02610ef547c92781c1ca94fa7f2de475748b9a30 /mysql-test
parent0726bb62424c1212a0fabc763e84d9c4f2259683 (diff)
parentf31095f3d56c76b035fd9c9d1b499ba293126917 (diff)
downloadmariadb-git-d825ed1a6bc937cba2b46b8194922a9559c6f45e.tar.gz
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/mysql-5.0
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp-error.result47
-rw-r--r--mysql-test/t/sp-error.test58
2 files changed, 105 insertions, 0 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 09d829e9d12..17a2050437f 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -786,3 +786,50 @@ END|
ERROR 0A000: HANDLER is not allowed in stored procedures
SELECT bug12995()|
ERROR 42000: FUNCTION test.bug12995 does not exist
+drop procedure if exists bug12712;
+drop function if exists bug12712;
+create procedure bug12712()
+set session autocommit = 0;
+select @@autocommit;
+@@autocommit
+1
+set @au = @@autocommit;
+call bug12712();
+select @@autocommit;
+@@autocommit
+0
+set session autocommit = @au;
+create function bug12712()
+returns int
+begin
+call bug12712();
+return 0;
+end|
+set @x = bug12712()|
+ERROR HY000: Not allowed to set autocommit from a stored function or trigger
+drop procedure bug12712|
+drop function bug12712|
+create function bug12712()
+returns int
+begin
+set session autocommit = 0;
+return 0;
+end|
+ERROR HY000: Not allowed to set autocommit from a stored function or trigger
+create function bug12712()
+returns int
+begin
+set @@autocommit = 0;
+return 0;
+end|
+ERROR HY000: Not allowed to set autocommit from a stored function or trigger
+create function bug12712()
+returns int
+begin
+set local autocommit = 0;
+return 0;
+end|
+ERROR HY000: Not allowed to set autocommit from a stored function or trigger
+create trigger bug12712
+before insert on t1 for each row set session autocommit = 0;
+ERROR HY000: Not allowed to set autocommit from a stored function or trigger
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 9f91c32c104..40f59f3f124 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1130,6 +1130,64 @@ END|
SELECT bug12995()|
delimiter ;|
+
+#
+# BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
+#
+--disable_warnings
+drop procedure if exists bug12712;
+drop function if exists bug12712;
+--enable_warnings
+# Can...
+create procedure bug12712()
+ set session autocommit = 0;
+
+select @@autocommit;
+set @au = @@autocommit;
+call bug12712();
+select @@autocommit;
+set session autocommit = @au;
+
+delimiter |;
+create function bug12712()
+ returns int
+begin
+ call bug12712();
+ return 0;
+end|
+
+# Can't...
+--error ER_SP_CANT_SET_AUTOCOMMIT
+set @x = bug12712()|
+drop procedure bug12712|
+drop function bug12712|
+--error ER_SP_CANT_SET_AUTOCOMMIT
+create function bug12712()
+ returns int
+begin
+ set session autocommit = 0;
+ return 0;
+end|
+--error ER_SP_CANT_SET_AUTOCOMMIT
+create function bug12712()
+ returns int
+begin
+ set @@autocommit = 0;
+ return 0;
+end|
+--error ER_SP_CANT_SET_AUTOCOMMIT
+create function bug12712()
+ returns int
+begin
+ set local autocommit = 0;
+ return 0;
+end|
+delimiter ;|
+--error ER_SP_CANT_SET_AUTOCOMMIT
+create trigger bug12712
+ before insert on t1 for each row set session autocommit = 0;
+
+
#
# BUG#NNNN: New bug synopsis
#