📄 sp_trans.result
字号:
drop table if exists t1, t2, t3;drop procedure if exists bug8850|create table t1 (a int) engine=innodb|create procedure bug8850()begintruncate table t1; insert t1 values (1); rollback;end|set autocommit=0|insert t1 values (2)|call bug8850()|commit|select * from t1|acall bug8850()|set autocommit=1|select * from t1|adrop table t1|drop procedure bug8850|drop function if exists bug10015_1|drop function if exists bug10015_2|drop function if exists bug10015_3|drop function if exists bug10015_4|drop function if exists bug10015_5|drop function if exists bug10015_6|drop function if exists bug10015_7|drop procedure if exists bug10015_8|create table t1 (id int) engine=innodb|create table t2 (id int primary key, j int) engine=innodb|insert into t1 values (1),(2),(3)|create function bug10015_1() returns int return (select count(*) from t1)|select *, bug10015_1() from t1|id bug10015_1()1 32 33 3drop function bug10015_1|create function bug10015_2() returns int begindeclare i, s int;set i:= (select min(id) from t1);set s:= (select max(id) from t1);return (s - i);end|select *, bug10015_2() from t1|id bug10015_2()1 22 23 2drop function bug10015_2|create function bug10015_3() returns int return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)|select *, bug10015_3() from t1|id bug10015_3()1 22 23 2drop function bug10015_3|create function bug10015_4(i int) returns int begindeclare m int;set m:= (select max(id) from t2);insert into t2 values (i, m);return m;end|select *, bug10015_4(id) from t1|id bug10015_4(id)1 NULL2 13 2select * from t2|id j1 NULL2 13 2drop function bug10015_4|create function bug10015_5(i int) returns intbeginif (i = 5) theninsert into t2 values (1, 0);end if;return i;end|insert into t1 values (bug10015_5(4)), (bug10015_5(5))|ERROR 23000: Duplicate entry '1' for key 1select * from t1|id123drop function bug10015_5|create function bug10015_6(i int) returns intbegindeclare continue handler for sqlexception set @error_in_func:= 1;if (i = 5) theninsert into t2 values (4, 0), (1, 0);end if;return i;end|set @error_in_func:= 0|insert into t1 values (bug10015_6(5)), (bug10015_6(6))|select @error_in_func|@error_in_func1select * from t1|id12356select * from t2|id j1 NULL2 13 24 0drop function bug10015_6|create function bug10015_7() returns intbeginalter table t1 add k int;return 1;end|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.create function bug10015_7() returns intbeginstart transaction;return 1;end|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.create function bug10015_7() returns intbegindrop table t1;return 1;end|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.create function bug10015_7() returns intbegindrop temporary table t1;return 1;end|drop function bug10015_7|create function bug10015_7() returns intbegincommit;return 1;end|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.create function bug10015_7() returns intbegincall bug10015_8();return 1;end|create procedure bug10015_8() alter table t1 add k int|select *, bug10015_7() from t1|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.drop procedure bug10015_8|create procedure bug10015_8() start transaction|select *, bug10015_7() from t1|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.drop procedure bug10015_8|create procedure bug10015_8() drop temporary table if exists t1_temp|select *, bug10015_7() from t1|id bug10015_7()1 12 13 15 16 1drop procedure bug10015_8|create procedure bug10015_8() commit|select *, bug10015_7() from t1|ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.drop procedure bug10015_8|drop function bug10015_7|drop table t1, t2|drop function if exists bug13825_0|drop function if exists bug13825_1|drop function if exists bug13825_2|drop function if exists bug13825_3|drop function if exists bug13825_4|drop function if exists bug13825_5|drop procedure if exists bug13825_0|drop procedure if exists bug13825_1|drop procedure if exists bug13825_2|drop table if exists t1|create table t1 (i int) engine=innodb|create table t2 (i int) engine=innodb|create function bug13825_0() returns intbeginrollback to savepoint x;return 1;end|create function bug13825_1() returns intbeginrelease savepoint x;return 1;end|create function bug13825_2() returns intbegininsert into t1 values (2);savepoint x;insert into t1 values (3);rollback to savepoint x;insert into t1 values (4);return 1;end|create procedure bug13825_0()beginrollback to savepoint x;end|create procedure bug13825_1()beginrelease savepoint x;end|create procedure bug13825_2()beginsavepoint x;end|insert into t2 values (1)|create trigger t2_bi before insert on t2 for each rowrollback to savepoint x|create trigger t2_bu before update on t2 for each rowrelease savepoint x|create trigger t2_bd before delete on t2 for each rowbegininsert into t1 values (2);savepoint x;insert into t1 values (3);rollback to savepoint x;insert into t1 values (4);end|create function bug13825_3(rb int) returns intbegininsert into t1 values(1);savepoint x;insert into t1 values(2);if rb thenrollback to savepoint x;end if;insert into t1 values(3);return rb;end|create function bug13825_4() returns intbeginsavepoint x;insert into t1 values(2);rollback to savepoint x;return 0;end|create function bug13825_5(p int) returns intbeginsavepoint x;insert into t2 values(p);rollback to savepoint x;insert into t2 values(p+1);return p;end|set autocommit= 0|begin |insert into t1 values (1)|savepoint x|set @a:= bug13825_0()|ERROR 42000: SAVEPOINT x does not existinsert into t2 values (2)|ERROR 42000: SAVEPOINT x does not existset @a:= bug13825_1()|ERROR 42000: SAVEPOINT x does not existupdate t2 set i = 2|ERROR 42000: SAVEPOINT x does not existset @a:= bug13825_2()|select * from t1|i124rollback to savepoint x|select * from t1|i1delete from t2|select * from t1|i124rollback to savepoint x|select * from t1|i1release savepoint x|set @a:= bug13825_2()|select * from t1|i124rollback to savepoint x|ERROR 42000: SAVEPOINT x does not existdelete from t1|commit|begin|insert into t1 values (5)|savepoint x|insert into t1 values (6)|call bug13825_0()|select * from t1|i5call bug13825_1()|rollback to savepoint x|ERROR 42000: SAVEPOINT x does not existsavepoint x|insert into t1 values (7)|call bug13825_2()|rollback to savepoint x|select * from t1|i57delete from t1|commit|set autocommit= 1|select bug13825_3(0)|bug13825_3(0)0select * from t1|i123delete from t1|select bug13825_3(1)|bug13825_3(1)1select * from t1|i13delete from t1|set autocommit= 0|begin|insert into t1 values (1)|set @a:= bug13825_4()|select * from t1|i1delete from t1|commit|set autocommit= 1|drop table t2|create table t2 (i int) engine=innodb|insert into t1 values (1), (bug13825_5(2)), (3)|select * from t1|i123select * from t2|i3drop function bug13825_0|drop function bug13825_1|drop function bug13825_2|drop function bug13825_3|drop function bug13825_4|drop function bug13825_5|drop procedure bug13825_0|drop procedure bug13825_1|drop procedure bug13825_2|drop table t1, t2|drop table if exists t3|drop procedure if exists bug14840_1|drop procedure if exists bug14840_2|create table t3(x int,y int,primary key (x)) engine=InnoDB|create procedure bug14840_1()begindeclare err int default 0;declare continue handler for sqlexceptionset err = err + 1;start transaction;update t3 set x = 1, y = 42 where x = 2;insert into t3 values (3, 4711);if err > 0 thenrollback;elsecommit;end if;select * from t3;end|create procedure bug14840_2()begindeclare err int default 0;declare continue handler for sqlexceptionbeginset err = err + 1;select err as 'Ping';end;update t3 set x = 1, y = 42 where x = 2;update t3 set x = 1, y = 42 where x = 2;insert into t3 values (3, 4711);select * from t3;end|insert into t3 values (1, 3), (2, 5)|call bug14840_1()|x y1 32 5delete from t3|insert into t3 values (1, 3), (2, 5)|call bug14840_2()|Ping1Ping2x y1 32 53 4711drop procedure bug14840_1|drop procedure bug14840_2|drop table t3|drop procedure if exists bug10656_create_index|drop procedure if exists bug10656_myjoin|drop procedure if exists bug10656_truncate_table|CREATE TABLE t3 (`ID` int(11) default NULL,`txt` char(5) default NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1|INSERT INTO t3 (`ID`,`txt`) VALUES(1,'a'), (2,'b'), (3,'c'), (4,'d')|CREATE TABLE t4 (`ID` int(11) default NULL,`txt` char(5) default NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1|INSERT INTO t4 (`ID`,`txt`) VALUES(1,'a'), (2,'b'), (3,'c'), (4,'d')|create procedure bug10656_create_index()begincreate index bug10656_my_index on t3 (ID);end|call bug10656_create_index()|create procedure bug10656_myjoin()beginupdate t3, t4 set t3.txt = t4.txt where t3.id = t4.id;end|call bug10656_myjoin()|create procedure bug10656_truncate_table()begintruncate table t3;end|call bug10656_truncate_table()|drop procedure bug10656_create_index|drop procedure bug10656_myjoin|drop procedure bug10656_truncate_table|drop table t3, t4|create table t3 (a int primary key,ach char(1)) engine = innodb|create table t4 (b int primary key,bch char(1)) engine = innodb|insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|Warnings:Warning 1265 Data truncated for column 'ach' at row 1Warning 1265 Data truncated for column 'ach' at row 2insert into t4 values (1 , 'bCh1' )|Warnings:Warning 1265 Data truncated for column 'bch' at row 1drop procedure if exists bug3448|create procedure bug3448()select * from t3 inner join t4 on t3.a = t4.b|select * from t3 inner join t4 on t3.a = t4.b|a ach b bch1 a 1 bcall bug3448()|a ach b bch1 a 1 bcall bug3448()|a ach b bch1 a 1 bdrop procedure bug3448|drop table t3, t4|drop procedure if exists bug14210|set @@session.max_heap_table_size=16384|select @@session.max_heap_table_size|@@session.max_heap_table_size16384create table t3 (a char(255)) engine=InnoDB|create procedure bug14210_fill_table()begindeclare table_size, max_table_size int default 0;select @@session.max_heap_table_size into max_table_size;delete from t3;insert into t3 (a) values (repeat('a', 255));repeatinsert into t3 select a from t3;select count(*)*255 from t3 into table_size;until table_size > max_table_size*2 end repeat;end|call bug14210_fill_table()|drop procedure bug14210_fill_table|create table t4 like t3|create procedure bug14210()begindeclare a char(255);declare done int default 0;declare c cursor for select * from t3;declare continue handler for sqlstate '02000' set done = 1;open c;repeatfetch c into a;if not done theninsert into t4 values (upper(a));end if;until done end repeat;close c;end|call bug14210()|select count(*) from t4|count(*)256drop table t3, t4|drop procedure bug14210|set @@session.max_heap_table_size=default|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -