diff options
author | pem@mysql.com <> | 2005-09-13 17:16:12 +0200 |
---|---|---|
committer | pem@mysql.com <> | 2005-09-13 17:16:12 +0200 |
commit | f31095f3d56c76b035fd9c9d1b499ba293126917 (patch) | |
tree | 0ea49f9919a82483665f1c90efb02d4d4c083545 /mysql-test/t/sp-error.test | |
parent | 5b8bfd4d95c95e8c04d2d12736c4d2026abd2b26 (diff) | |
download | mariadb-git-f31095f3d56c76b035fd9c9d1b499ba293126917.tar.gz |
Fixed BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
Second version after review. Allow 'set autocommit' in procedures, but not
functions or triggers. Can return error in run-time (when a function calls
a procedure).
Diffstat (limited to 'mysql-test/t/sp-error.test')
-rw-r--r-- | mysql-test/t/sp-error.test | 58 |
1 files changed, 58 insertions, 0 deletions
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 # |