📄 sp-prelocking.result
字号:
drop database if exists mysqltest;drop table if exists t1, t2, t3, t4;drop procedure if exists sp1;drop procedure if exists sp2;drop procedure if exists sp3;drop procedure if exists sp4;drop function if exists f1;drop function if exists f2;drop function if exists f3;create database mysqltest;use mysqltest//create procedure sp1 () begindrop table if exists t1;select 1 as "my-col";end;//select database();database()mysqltestcall sp1();my-col1Warnings:Note 1051 Unknown table 't1'select database();database()mysqltestuse test;select database();database()testcall mysqltest.sp1();my-col1Warnings:Note 1051 Unknown table 't1'select database();database()testdrop procedure mysqltest.sp1;drop database mysqltest;create procedure sp1() begin create table t1 (a int); insert into t1 values (10); end//create procedure sp2()begincreate table t2(a int);insert into t2 values(1);call sp1();end//create function f1() returns intbegin return (select max(a) from t1);end//create procedure sp3()begin call sp1();select 'func', f1();end//call sp1();select 't1',a from t1;t1 at1 10drop table t1;call sp2();select 't1',a from t1;t1 at1 10select 't2',a from t2;t2 at2 1drop table t1, t2;call sp3();func f1()func 10select 't1',a from t1;t1 at1 10drop table t1;drop procedure sp1;drop procedure sp2;drop procedure sp3;drop function f1;create procedure sp1()begincreate temporary table t2(a int);insert into t2 select * from t1;end//create procedure sp2()begincreate temporary table t1 (a int);insert into t1 values(1);call sp1();select 't1', a from t1;select 't2', a from t2;drop table t1;drop table t2;end//call sp2();t1 at1 1t2 at2 1drop procedure sp1;drop procedure sp2;create table t1 (a int);insert into t1 values(1),(2);create table t2 as select * from t1;create table t3 as select * from t1;create table t4 as select * from t1;create procedure sp1(a int)beginselect a;end //create function f1() returns intbeginreturn (select max(a) from t1);end //CALL sp1(f1());a2create procedure sp2(a int)beginselect * from t3;select a;end //create procedure sp3()begin select * from t1;call sp2(5);end //create procedure sp4()begin select * from t2;call sp3();end //call sp4();a12a12a12a5drop procedure sp1;drop procedure sp2;drop procedure sp3;drop procedure sp4;drop function f1;drop view if exists v1;create function f1(ab int) returns intbegindeclare i int;set i= (select max(a) from t1 where a < ab) ;return i;end //create function f2(ab int) returns intbegindeclare i int;set i= (select max(a) from t2 where a < ab) ;return i;end //create view v1 as select t3.a as x, t4.a as y, f2(3) as zfrom t3, t4 where t3.a = t4.a //create procedure sp1()begindeclare a int;set a= (select f1(4) + count(*) A from t1, v1);end //create function f3() returns intbegincall sp1();return 1;end //call sp1() //select f3() //f3()1select f3() //f3()1call sp1() //drop procedure sp1//drop function f3//create procedure sp1() begin declare x int;declare c cursor for select f1(3) + count(*) from v1;open c;fetch c into x;end;//create function f3() returns intbegincall sp1();return 1;end //call sp1() //call sp1() //select f3() //f3()1call sp1() //drop view v1;drop table t1,t2,t3,t4;drop function f1;drop function f2;drop function f3;drop procedure sp1;drop table if exists t1;drop view if exists v1, v2, v3;drop function if exists bug15683;create table t1 (f1 bigint, f2 varchar(20), f3 bigint);insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;create view v1 as select 1 from t1 union all select 1;create view v2 as select 1 from v1;create view v3 as select 1 as f1 from v2;create function bug15683() returns bigintbeginreturn (select count(*) from v3);end|prepare stmt from "select bug15683()";execute stmt;bug15683()2execute stmt;bug15683()2deallocate prepare stmt;drop table t1;drop view v1, v2, v3;drop function bug15683;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -