1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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).
This commit is contained in:
pem@mysql.com
2005-09-13 17:16:12 +02:00
parent 5b8bfd4d95
commit f31095f3d5
7 changed files with 125 additions and 5 deletions

View File

@@ -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