mark some file to been opensource for ce-farm
This commit is contained in:
@ -0,0 +1,100 @@
|
||||
result_format: 4
|
||||
drop table if exists tab_proc;
|
||||
create table tab_proc(content varchar(255));
|
||||
|
||||
drop procedure if exists my_proc;
|
||||
create procedure my_proc()
|
||||
begin
|
||||
insert into tab_proc values("normal procedure call");
|
||||
end;//
|
||||
|
||||
call my_proc();
|
||||
|
||||
select * from tab_proc;
|
||||
+-----------------------+
|
||||
| content |
|
||||
+-----------------------+
|
||||
| normal procedure call |
|
||||
+-----------------------+
|
||||
drop procedure my_proc;
|
||||
truncate table tab_proc;
|
||||
|
||||
drop procedure if exists my_proc;
|
||||
create procedure my_proc(depth int, current int)
|
||||
begin
|
||||
if current < depth
|
||||
then
|
||||
set current = current + 1;
|
||||
call my_proc(depth, current);
|
||||
end if;
|
||||
insert into tab_proc values("recursion call");
|
||||
end;//
|
||||
|
||||
call my_proc(1, 1);
|
||||
call my_proc(2, 1);
|
||||
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine
|
||||
call my_proc(3, 1);
|
||||
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine
|
||||
set @@max_sp_recursion_depth = 3;
|
||||
call my_proc(3, 1);
|
||||
|
||||
select * from tab_proc;
|
||||
+----------------+
|
||||
| content |
|
||||
+----------------+
|
||||
| recursion call |
|
||||
| recursion call |
|
||||
| recursion call |
|
||||
| recursion call |
|
||||
+----------------+
|
||||
|
||||
drop procedure my_proc;
|
||||
truncate table tab_proc;
|
||||
|
||||
drop procedure if exists my_proc1;
|
||||
drop procedure if exists my_proc2;
|
||||
create procedure my_proc1(depth int, current int)
|
||||
begin
|
||||
if current < depth
|
||||
then
|
||||
set current = current + 1;
|
||||
call my_proc2(depth, current);
|
||||
end if;
|
||||
insert into tab_proc values("my_proc1");
|
||||
end;//
|
||||
|
||||
create procedure my_proc2(depth int, current int)
|
||||
begin
|
||||
if current < depth
|
||||
then
|
||||
set current = current + 1;
|
||||
call my_proc1(depth, current);
|
||||
end if;
|
||||
insert into tab_proc values("my_proc2");
|
||||
end;//
|
||||
|
||||
set @@max_sp_recursion_depth = 0;
|
||||
call my_proc1(2, 1);
|
||||
call my_proc1(5, 1);
|
||||
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine
|
||||
set @@max_sp_recursion_depth = 3;
|
||||
call my_proc1(5, 1);
|
||||
|
||||
select * from tab_proc;
|
||||
+----------+
|
||||
| content |
|
||||
+----------+
|
||||
| my_proc2 |
|
||||
| my_proc1 |
|
||||
| my_proc1 |
|
||||
| my_proc2 |
|
||||
| my_proc1 |
|
||||
| my_proc2 |
|
||||
| my_proc1 |
|
||||
+----------+
|
||||
drop procedure my_proc1;
|
||||
drop procedure my_proc2;
|
||||
drop table tab_proc;
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,142 @@
|
||||
result_format: 4
|
||||
alter system flush plan cache global;
|
||||
alter system flush pl cache global;
|
||||
|
||||
use test;
|
||||
|
||||
drop table if exists my_bit_1;
|
||||
drop table if exists my_bit_32;
|
||||
drop table if exists my_bit_64;
|
||||
drop procedure if exists my_bit_1;
|
||||
drop procedure if exists my_bit_32;
|
||||
drop procedure if exists my_bit_64;
|
||||
drop function if exists my_bit_1;
|
||||
drop function if exists my_bit_32;
|
||||
drop function if exists my_bit_64;
|
||||
create table my_bit_1(col bit(1));
|
||||
create table my_bit_32(col bit(32));
|
||||
create table my_bit_64(col bit(64));
|
||||
|
||||
insert into my_bit_1 values(1);
|
||||
insert into my_bit_32 values(32);
|
||||
insert into my_bit_64 values(64);
|
||||
|
||||
create procedure my_bit_1(OUT v bit(1))
|
||||
begin
|
||||
select col from my_bit_1 into v;
|
||||
end |
|
||||
|
||||
create procedure my_bit_32(OUT v bit(32))
|
||||
begin
|
||||
select col from my_bit_32 into v;
|
||||
end |
|
||||
|
||||
create procedure my_bit_64(OUT v bit(64))
|
||||
begin
|
||||
select col from my_bit_64 into v;
|
||||
end |
|
||||
|
||||
create function my_bit_1() returns bit(1)
|
||||
begin
|
||||
declare v bit(1);
|
||||
call my_bit_1(v);
|
||||
return v;
|
||||
end |
|
||||
|
||||
create function my_bit_32() returns bit(32)
|
||||
begin
|
||||
declare v bit(32);
|
||||
call my_bit_32(v);
|
||||
return v;
|
||||
end |
|
||||
|
||||
create function my_bit_64() returns bit(64)
|
||||
begin
|
||||
declare v bit(64);
|
||||
call my_bit_64(v);
|
||||
return v;
|
||||
end |
|
||||
|
||||
|
||||
select cast(my_bit_1() as signed);
|
||||
+----------------------------+
|
||||
| cast(my_bit_1() as signed) |
|
||||
+----------------------------+
|
||||
| 1 |
|
||||
+----------------------------+
|
||||
select cast(my_bit_32() as signed);
|
||||
+-----------------------------+
|
||||
| cast(my_bit_32() as signed) |
|
||||
+-----------------------------+
|
||||
| 32 |
|
||||
+-----------------------------+
|
||||
select cast(my_bit_64() as signed);
|
||||
+-----------------------------+
|
||||
| cast(my_bit_64() as signed) |
|
||||
+-----------------------------+
|
||||
| 64 |
|
||||
+-----------------------------+
|
||||
|
||||
drop table my_bit_1;
|
||||
drop table my_bit_32;
|
||||
drop table my_bit_64;
|
||||
drop procedure my_bit_1;
|
||||
drop procedure my_bit_32;
|
||||
drop procedure my_bit_64;
|
||||
drop function my_bit_1;
|
||||
drop function my_bit_32;
|
||||
drop function my_bit_64;
|
||||
|
||||
drop function if exists my_bit_bit;
|
||||
drop function if exists my_bit_char;
|
||||
drop function if exists my_bit_int;
|
||||
drop function if exists my_bit_double;
|
||||
create function my_bit_bit(v bit(32)) returns bit(32)
|
||||
begin
|
||||
set v := v + 1;
|
||||
return v;
|
||||
end |
|
||||
|
||||
create function my_bit_char(v bit(1)) returns char(1)
|
||||
begin
|
||||
set v := v + 1;
|
||||
return v;
|
||||
end |
|
||||
|
||||
create function my_bit_int(v bit(1)) returns int
|
||||
begin
|
||||
set v := v + 1;
|
||||
return v;
|
||||
end |
|
||||
|
||||
create function my_bit_double(v bit(32)) returns double
|
||||
begin
|
||||
set v := v + 1;
|
||||
return v;
|
||||
end |
|
||||
|
||||
select cast(my_bit_bit(1) as signed);
|
||||
+-------------------------------+
|
||||
| cast(my_bit_bit(1) as signed) |
|
||||
+-------------------------------+
|
||||
| 2 |
|
||||
+-------------------------------+
|
||||
select my_bit_char(1);
|
||||
ERROR 22001: Data too long for column
|
||||
select my_bit_int(1);
|
||||
ERROR 22001: Data too long for column
|
||||
select my_bit_double(1);
|
||||
+------------------+
|
||||
| my_bit_double(1) |
|
||||
+------------------+
|
||||
| 2 |
|
||||
+------------------+
|
||||
|
||||
drop function my_bit_bit;
|
||||
drop function my_bit_char;
|
||||
drop function my_bit_int;
|
||||
drop function my_bit_double;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
result_format: 4
|
||||
use test;
|
||||
|
||||
DROP FUNCTION IF EXISTS BUG16302573;
|
||||
|
||||
|
||||
CREATE FUNCTION BUG16302573(p1 INTEGER) RETURNS INTEGER
|
||||
LANGUAGE SQL
|
||||
DETERMINISTIC
|
||||
RETURN p1|
|
||||
SELECT BUG16302573(1024)|
|
||||
+-------------------+
|
||||
| BUG16302573(1024) |
|
||||
+-------------------+
|
||||
| 1024 |
|
||||
+-------------------+
|
||||
DROP FUNCTION BUG16302573|
|
||||
|
||||
CREATE FUNCTION BUG16302573() RETURNS INT(11)
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
DECLARE x INT(11);
|
||||
SET x=-1;
|
||||
RETURN x;
|
||||
END|
|
||||
SELECT BUG16302573()|
|
||||
+---------------+
|
||||
| BUG16302573() |
|
||||
+---------------+
|
||||
| -1 |
|
||||
+---------------+
|
||||
DROP FUNCTION BUG16302573|
|
||||
|
||||
CREATE FUNCTION BUG16302573() RETURNS DATETIME
|
||||
NOT DETERMINISTIC
|
||||
NO SQL
|
||||
RETURN NOW()|
|
||||
DROP FUNCTION BUG16302573|
|
||||
|
||||
CREATE PROCEDURE BUG16302573()
|
||||
LANGUAGE SQL
|
||||
MODIFIES SQL DATA
|
||||
NOT DETERMINISTIC
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT 'Characteristics procedure test'
|
||||
BEGIN END|
|
||||
CALL BUG16302573()|
|
||||
DROP PROCEDURE BUG16302573|
|
||||
|
||||
CREATE FUNCTION BUG16302573(p INT(8)) RETURNS BIGINT(11) UNSIGNED
|
||||
READS SQL DATA
|
||||
RETURN FLOOR(p/1000)*1000000 + 100000 + FLOOR((p MOD 1000)/10)*100 + (p MOD 10)|
|
||||
SELECT BUG16302573(1)|
|
||||
+----------------+
|
||||
| BUG16302573(1) |
|
||||
+----------------+
|
||||
| 100001 |
|
||||
+----------------+
|
||||
DROP FUNCTION BUG16302573|
|
||||
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
result_format: 4
|
||||
drop database if exists my_db;
|
||||
create database my_db;
|
||||
use my_db;
|
||||
|
||||
drop table if exists my_tab;
|
||||
drop function if exists my_func;
|
||||
create function my_func() returns int return null;
|
||||
create table my_tab as select my_func();
|
||||
|
||||
select my_func();
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| NULL |
|
||||
+-----------+
|
||||
select * from my_tab;
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| NULL |
|
||||
+-----------+
|
||||
show create table my_tab;
|
||||
Table Create Table
|
||||
my_tab CREATE TABLE `my_tab` (
|
||||
`my_func()` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
|
||||
drop table my_tab;
|
||||
|
||||
use test;
|
||||
|
||||
create table my_tab as select my_func();
|
||||
ERROR 42000: FUNCTION my_func does not exist
|
||||
create table my_tab as select my_db.my_func();
|
||||
|
||||
select my_func();
|
||||
ERROR 42000: FUNCTION my_func does not exist
|
||||
select my_db.my_func();
|
||||
+-----------------+
|
||||
| my_db.my_func() |
|
||||
+-----------------+
|
||||
| NULL |
|
||||
+-----------------+
|
||||
select * from my_tab;
|
||||
+-----------------+
|
||||
| my_db.my_func() |
|
||||
+-----------------+
|
||||
| NULL |
|
||||
+-----------------+
|
||||
show create table my_tab;
|
||||
Table Create Table
|
||||
my_tab CREATE TABLE `my_tab` (
|
||||
`my_db.my_func()` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
drop table my_tab;
|
||||
|
||||
create function my_func() returns int return 1;
|
||||
create table my_tab as select my_func();
|
||||
select my_func();
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
select * from my_tab;
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
show create table my_tab;
|
||||
Table Create Table
|
||||
my_tab CREATE TABLE `my_tab` (
|
||||
`my_func()` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
|
||||
drop function my_func;
|
||||
drop table my_tab;
|
||||
|
||||
use my_db;
|
||||
drop function my_func;
|
||||
drop database my_db;
|
||||
|
||||
use test;
|
||||
@ -0,0 +1,954 @@
|
||||
result_format: 4
|
||||
use test;
|
||||
|
||||
|
||||
##
|
||||
create procedure foo()
|
||||
foo: loop
|
||||
leave bar;
|
||||
end loop|
|
||||
ERROR 42000: no matching label: bar
|
||||
|
||||
create procedure foo()
|
||||
foo: loop
|
||||
iterate bar;
|
||||
end loop|
|
||||
ERROR 42000: no matching label: bar
|
||||
|
||||
create procedure foo()
|
||||
foo: begin
|
||||
iterate foo;
|
||||
end|
|
||||
ERROR 42000: no matching label: foo
|
||||
|
||||
create function bug8408() returns int
|
||||
begin
|
||||
select * from t1;
|
||||
return 0;
|
||||
end|
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
|
||||
create procedure p(in x int, x char(10))
|
||||
begin
|
||||
end|
|
||||
ERROR 42000: Duplicate parameter: x
|
||||
|
||||
create function p(x int, x char(10)) returns int
|
||||
begin
|
||||
end|
|
||||
ERROR 42000: Duplicate parameter: x
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare x float;
|
||||
declare x int;
|
||||
end|
|
||||
ERROR 42000: Duplicate variable: x
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c condition for 1064;
|
||||
declare c condition for 1065;
|
||||
end|
|
||||
ERROR 42000: Duplicate condition: c
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare c cursor for select field from t1;
|
||||
end|
|
||||
ERROR 42000: Duplicate cursor: c
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from test.t;
|
||||
open cc;
|
||||
close cc;
|
||||
end|
|
||||
ERROR 42000: Undefined CURSOR: cc
|
||||
|
||||
create procedure p(val int, out res int)
|
||||
begin
|
||||
declare x int default 0;
|
||||
declare continue handler for foo set x = 1;
|
||||
insert into test.t1 values (val);
|
||||
if (x) then
|
||||
set res = 0;
|
||||
else
|
||||
set res = 1;
|
||||
end if;
|
||||
end |
|
||||
ERROR 42000: Undefined CONDITION: foo
|
||||
|
||||
##
|
||||
create procedure foo()
|
||||
create procedure bar() set @x=3|
|
||||
ERROR 2F003: Can't create a routine from within another routine
|
||||
|
||||
create procedure foo()
|
||||
create function bar() returns double return 2.3|
|
||||
ERROR 2F003: Can't create a routine from within another routine
|
||||
|
||||
##
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare continue handler for sqlexception select 1;
|
||||
declare continue handler for sqlexception select 2;
|
||||
end|
|
||||
ERROR 42000: Duplicate handler declared in the same block
|
||||
|
||||
##
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
end |
|
||||
ERROR 42000: Variable or condition declaration after cursor or handler declaration
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '42S99' set x = 1;
|
||||
declare foo condition for sqlstate '42S99';
|
||||
end |
|
||||
ERROR 42000: Variable or condition declaration after cursor or handler declaration
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '42S99' set x = 1;
|
||||
declare c cursor for select * from t1;
|
||||
end |
|
||||
ERROR 42000: Cursor declaration after handler declaration
|
||||
|
||||
##
|
||||
create database mysqltest1|
|
||||
use mysqltest1|
|
||||
drop database mysqltest1|
|
||||
create function f1() returns int return 1|
|
||||
ERROR 3D000: No database selected
|
||||
use test|
|
||||
|
||||
drop procedure if exists bug15091|
|
||||
create procedure bug15091()
|
||||
begin
|
||||
declare selectstr varchar(6000) default ' ';
|
||||
declare conditionstr varchar(5000) default '';
|
||||
set selectstr = concat(selectstr, ' and ', c.operatorid, 'in (',conditionstr, ')');
|
||||
end|
|
||||
ERROR 42S02: Unknown table 'c' in
|
||||
|
||||
create procedure ` `() select 1|
|
||||
ERROR 42000: Incorrect routine name ' '
|
||||
|
||||
create procedure ``() select 1|
|
||||
ERROR 42000: Incorrect routine name ''
|
||||
|
||||
##
|
||||
drop procedure if exists p|
|
||||
drop table if exists t1|
|
||||
create table t1(col int)|
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
open c;
|
||||
open c;
|
||||
close c;
|
||||
end|
|
||||
|
||||
call p()|
|
||||
ERROR 24000: Cursor is already open
|
||||
drop procedure p|
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
open c;
|
||||
close c;
|
||||
close c;
|
||||
end |
|
||||
drop procedure p|
|
||||
|
||||
create procedure bug2259()
|
||||
begin
|
||||
declare v1 int;
|
||||
declare c1 cursor for select col from t1;
|
||||
fetch c1 into v1;
|
||||
end|
|
||||
call bug2259()|
|
||||
ERROR 24000: Cursor is not open
|
||||
drop procedure bug2259|
|
||||
drop table t1|
|
||||
|
||||
##
|
||||
create procedure bug8776_1()
|
||||
begin
|
||||
declare continue handler for sqlstate '42S0200test' begin end;
|
||||
begin end;
|
||||
end |
|
||||
ERROR 42000: Bad SQLSTATE: '42S0200test'
|
||||
|
||||
##
|
||||
drop procedure if exists p|
|
||||
create procedure p(in x int, inout y int, out z int)
|
||||
begin
|
||||
set y = x+y;
|
||||
set z = x+y;
|
||||
end|
|
||||
|
||||
set @tmp_x = 42|
|
||||
set @tmp_y = 3|
|
||||
set @tmp_z = 0|
|
||||
call p(@tmp_x, @tmp_y, @tmp_z)|
|
||||
select @tmp_x, @tmp_y, @tmp_z |
|
||||
+--------+--------+--------+
|
||||
| @tmp_x | @tmp_y | @tmp_z |
|
||||
+--------+--------+--------+
|
||||
| 42 | 45 | 87 |
|
||||
+--------+--------+--------+
|
||||
|
||||
call p(42, 43, @tmp_z)|
|
||||
ERROR 42000: OUT or INOUT argument 1 for routine p is not a variable
|
||||
|
||||
drop procedure p|
|
||||
|
||||
##
|
||||
create procedure foo() return 42|
|
||||
ERROR 42000: RETURN is only allowed in a FUNCTION
|
||||
|
||||
##
|
||||
create procedure p()
|
||||
begin
|
||||
declare x int;
|
||||
declare c cursor for select * from t limit 1 into x;
|
||||
open c;
|
||||
close c;
|
||||
end |
|
||||
ERROR 42000: Cursor SELECT must not have INTO
|
||||
|
||||
##
|
||||
drop procedure 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|
|
||||
|
||||
drop function if exists bug12712|
|
||||
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 function bug12712|
|
||||
drop procedure 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
|
||||
|
||||
|
||||
DROP FUNCTION my_func;
|
||||
DROP PROCEDURE my_proc;
|
||||
|
||||
CREATE FUNCTION my_func(x INT, y INT, z INT) RETURNS INT BEGIN RETURN 0; END; /
|
||||
CREATE PROCEDURE my_proc(IN x INT, OUT y INT, INOUT z INT) BEGIN END;
|
||||
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='my_func';
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
| SPECIFIC_CATALOG | SPECIFIC_SCHEMA | SPECIFIC_NAME | ORDINAL_POSITION | PARAMETER_MODE | PARAMETER_NAME | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | DTD_IDENTIFIER | ROUTINE_TYPE |
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
| def | test | my_func | 0 | NULL | NULL | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | FUNCTION |
|
||||
| def | test | my_func | 1 | IN | x | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | FUNCTION |
|
||||
| def | test | my_func | 2 | IN | y | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | FUNCTION |
|
||||
| def | test | my_func | 3 | IN | z | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | FUNCTION |
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='my_proc';
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
| SPECIFIC_CATALOG | SPECIFIC_SCHEMA | SPECIFIC_NAME | ORDINAL_POSITION | PARAMETER_MODE | PARAMETER_NAME | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | DTD_IDENTIFIER | ROUTINE_TYPE |
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
| def | test | my_proc | 1 | IN | x | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | PROCEDURE |
|
||||
| def | test | my_proc | 2 | OUT | y | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | PROCEDURE |
|
||||
| def | test | my_proc | 3 | INOUT | z | int | NULL | NULL | 11 | 0 | NULL | binary | binary | int(11) | PROCEDURE |
|
||||
+------------------+-----------------+---------------+------------------+----------------+----------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+--------------+
|
||||
DROP PROCEDURE my_proc;
|
||||
DROP FUNCTION my_func;
|
||||
|
||||
## AONE:
|
||||
select time_zone=@@time_zone;
|
||||
ERROR 42S22: Unknown column 'time_zone' in 'field list'
|
||||
select time_zone;
|
||||
ERROR 42S22: Unknown column 'time_zone' in 'field list'
|
||||
select @@time_zone;
|
||||
+-------------+
|
||||
| @@time_zone |
|
||||
+-------------+
|
||||
| +08:00 |
|
||||
+-------------+
|
||||
select connect_timeout = @@session.connect_timeout;
|
||||
ERROR 42S22: Unknown column 'connect_timeout' in 'field list'
|
||||
select connect_timeout;
|
||||
ERROR 42S22: Unknown column 'connect_timeout' in 'field list'
|
||||
select @@session.connect_timeout;
|
||||
ERROR HY000: Variable 'connect_timeout' is a GLOBAL variable
|
||||
|
||||
##
|
||||
create procedure proc_ret()
|
||||
begin
|
||||
return ;
|
||||
end;
|
||||
/
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '' at line 0
|
||||
|
||||
create procedure proc_ret()
|
||||
begin
|
||||
return null;
|
||||
end;
|
||||
/
|
||||
ERROR 42000: RETURN is only allowed in a FUNCTION
|
||||
|
||||
create function func_ret()
|
||||
returns int
|
||||
begin
|
||||
return ;
|
||||
end;
|
||||
/
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '' at line 0
|
||||
|
||||
####
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT, b INT);
|
||||
INSERT INTO t1 values (1,1),(2,2);
|
||||
|
||||
DROP FUNCTION fn;/
|
||||
CREATE FUNCTION fn(a INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
/
|
||||
SELECT fn(MIN(b)) FROM t1;
|
||||
/
|
||||
+------------+
|
||||
| fn(MIN(b)) |
|
||||
+------------+
|
||||
| 1 |
|
||||
+------------+
|
||||
DROP TABLE t1;
|
||||
/
|
||||
DROP FUNCTION fn;
|
||||
/
|
||||
|
||||
DROP PROCEDURE proc;
|
||||
/
|
||||
CREATE PROCEDURE proc(OUT x enum('1', '2'), OUT y set('3', '4'))
|
||||
BEGIN
|
||||
SET x = '2';
|
||||
SET y = '4';
|
||||
END;
|
||||
/
|
||||
CALL proc(@a, @b);
|
||||
/
|
||||
DROP PROCEDURE proc;
|
||||
/
|
||||
|
||||
drop function f1;
|
||||
|
||||
CREATE FUNCTION f1() RETURNS VARCHAR(65525) RETURN 'Hello';
|
||||
|
||||
SET collation_connection='gbk_bin';
|
||||
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
create table t1(c1 int);
|
||||
insert into t1 values(0);
|
||||
|
||||
drop view v1;
|
||||
create view v1 as select f1() from dual;
|
||||
select * from t1 union select * from v1;
|
||||
+-------+
|
||||
| c1 |
|
||||
+-------+
|
||||
| 0 |
|
||||
| Hello |
|
||||
+-------+
|
||||
drop view v1;
|
||||
|
||||
drop function f1;
|
||||
|
||||
### ctas support questionmark
|
||||
###
|
||||
drop table if exists t;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
create table t (a1 int, b1 int);
|
||||
insert into t values(1,1),(2,2),(3,3);
|
||||
|
||||
create procedure p(arg1 int)
|
||||
begin
|
||||
create table t1 as select * from t where a1<arg1;
|
||||
end;
|
||||
/
|
||||
|
||||
###
|
||||
call p(1)/
|
||||
|
||||
|
||||
select * from t1;/
|
||||
+------+------+
|
||||
| a1 | b1 |
|
||||
+------+------+
|
||||
+------+------+
|
||||
|
||||
PREPARE pr1 FROM 'create table t2 as select * from t where a1<?';/
|
||||
SET @var = 10;/
|
||||
|
||||
###
|
||||
EXECUTE pr1 USING @var;/
|
||||
|
||||
|
||||
select * from t2;/
|
||||
+------+------+
|
||||
| a1 | b1 |
|
||||
+------+------+
|
||||
| 1 | 1 |
|
||||
| 2 | 2 |
|
||||
| 3 | 3 |
|
||||
+------+------+
|
||||
|
||||
create table t3 as select * from t where a1<?;/
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use
|
||||
|
||||
|
||||
select * from t3;/
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
|
||||
|
||||
drop table if exists t;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t3'
|
||||
|
||||
|
||||
###
|
||||
drop table if exists t4/
|
||||
create table t4 (id int)/
|
||||
insert into t4 values (1),(2),(3)/
|
||||
drop procedure if exists pro_hr/
|
||||
create procedure pro_hr()
|
||||
begin
|
||||
create or replace view v2 as select * from t4 where id > 2;
|
||||
end;
|
||||
/
|
||||
call pro_hr()/
|
||||
select * from v2/
|
||||
+------+
|
||||
| id |
|
||||
+------+
|
||||
| 3 |
|
||||
+------+
|
||||
|
||||
|
||||
drop table t4;
|
||||
drop procedure pro_hr;
|
||||
drop view v2;
|
||||
|
||||
####
|
||||
###
|
||||
drop table if exists t1;
|
||||
drop procedure if exists bug36052430;
|
||||
create table t1(type int, salary double);
|
||||
|
||||
insert into t1 values(1,1000);
|
||||
|
||||
|
||||
create procedure bug36052430()
|
||||
begin
|
||||
start transaction;
|
||||
savepoint s1;
|
||||
insert into t1 values(3,3000);
|
||||
savepoint s2;
|
||||
insert into t1 values(4,4000);
|
||||
select * from t1;
|
||||
rollback to savepoint s2;
|
||||
select * from t1;
|
||||
end/
|
||||
|
||||
call bug36052430()/
|
||||
+------+--------+
|
||||
| type | salary |
|
||||
+------+--------+
|
||||
+------+--------+
|
||||
| type | salary |
|
||||
+------+--------+
|
||||
| 1 | 1000 |
|
||||
| 3 | 3000 |
|
||||
| 4 | 4000 |
|
||||
| 1 | 1000 |
|
||||
| 3 | 3000 |
|
||||
+------+--------+
|
||||
+------+--------+
|
||||
|
||||
|
||||
release savepoint s1;
|
||||
drop table t1;
|
||||
drop procedure bug36052430;
|
||||
|
||||
###
|
||||
###
|
||||
drop table if exists t1;
|
||||
drop procedure if exists desc_proc;
|
||||
create table t1(id int, name varchar(10));
|
||||
|
||||
insert into t1 values(351303, 'hr');
|
||||
|
||||
|
||||
create procedure desc_proc()
|
||||
begin
|
||||
describe t1;
|
||||
desc t1;
|
||||
explain t1;
|
||||
end/
|
||||
|
||||
call desc_proc()/
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
| id | int(11) | YES | | NULL | |
|
||||
| name | varchar(10) | YES | | NULL | |
|
||||
| id | int(11) | YES | | NULL | |
|
||||
| name | varchar(10) | YES | | NULL | |
|
||||
| id | int(11) | YES | | NULL | |
|
||||
| name | varchar(10) | YES | | NULL | |
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
+-------+-------------+------+-----+---------+-------+
|
||||
|
||||
drop table t1;
|
||||
drop procedure desc_proc;
|
||||
|
||||
###
|
||||
drop table if exists t_hr;
|
||||
drop function if exists f_hr;
|
||||
drop procedure if exists p_hr;
|
||||
create table t_hr(id int auto_increment not null primary key, name varchar(10) not null);
|
||||
|
||||
insert into t_hr values(null, 'hr');
|
||||
|
||||
select last_insert_id();
|
||||
+------------------+
|
||||
| last_insert_id() |
|
||||
+------------------+
|
||||
| 1 |
|
||||
+------------------+
|
||||
|
||||
|
||||
create function f_hr(s int)
|
||||
returns int deterministic
|
||||
begin
|
||||
insert into t_hr values(null, 'f');
|
||||
return s;
|
||||
end/
|
||||
|
||||
select f_hr(2)/
|
||||
+---------+
|
||||
| f_hr(2) |
|
||||
+---------+
|
||||
| 2 |
|
||||
+---------+
|
||||
|
||||
select last_insert_id()/
|
||||
+------------------+
|
||||
| last_insert_id() |
|
||||
+------------------+
|
||||
| 1 |
|
||||
+------------------+
|
||||
|
||||
create procedure p_hr()
|
||||
begin
|
||||
insert into t_hr values(null, 'f');
|
||||
end/
|
||||
|
||||
call p_hr()/
|
||||
|
||||
select * from t_hr/
|
||||
+----+------+
|
||||
| id | name |
|
||||
+----+------+
|
||||
| 1 | hr |
|
||||
| 2 | f |
|
||||
| 3 | f |
|
||||
+----+------+
|
||||
select last_insert_id()/
|
||||
+------------------+
|
||||
| last_insert_id() |
|
||||
+------------------+
|
||||
| 3 |
|
||||
+------------------+
|
||||
|
||||
drop table t_hr;
|
||||
drop function f_hr;
|
||||
drop procedure p_hr;
|
||||
|
||||
###
|
||||
drop table if exists t;
|
||||
drop function if exists func_hr;
|
||||
drop function if exists func1_hr;
|
||||
create table t(id int);
|
||||
insert into t values(1),(2),(3),(4);
|
||||
select * from t;
|
||||
+------+
|
||||
| id |
|
||||
+------+
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |
|
||||
| 4 |
|
||||
+------+
|
||||
create function func_hr()
|
||||
returns int
|
||||
begin
|
||||
declare offset int;
|
||||
declare nums int;
|
||||
declare s_id int;
|
||||
set offset = 2;
|
||||
set nums = 1;
|
||||
select id into s_id from t limit offset,nums;
|
||||
set offset = 1;
|
||||
select id into s_id from t limit offset,nums;
|
||||
return s_id;
|
||||
end/
|
||||
select func_hr()/
|
||||
+-----------+
|
||||
| func_hr() |
|
||||
+-----------+
|
||||
| 2 |
|
||||
+-----------+
|
||||
create function func1_hr()
|
||||
returns int
|
||||
begin
|
||||
declare nums int;
|
||||
declare s_id int;
|
||||
set nums = 1;
|
||||
select id into s_id from t limit nums;
|
||||
return s_id;
|
||||
end/
|
||||
select func1_hr()/
|
||||
+------------+
|
||||
| func1_hr() |
|
||||
+------------+
|
||||
| 1 |
|
||||
+------------+
|
||||
drop table if exists t;
|
||||
drop function func_hr;
|
||||
drop function func1_hr;
|
||||
|
||||
###
|
||||
drop procedure if exists bugs1;
|
||||
drop procedure if exists bugs4;
|
||||
create procedure bugs1()
|
||||
begin
|
||||
select 2 union select 2 into @v1;
|
||||
end/
|
||||
|
||||
call bugs1()/
|
||||
select @v1/
|
||||
+------+
|
||||
| @v1 |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
create procedure bugs2()
|
||||
begin
|
||||
select 2 union select 2 into @v2 union select 2;
|
||||
end/
|
||||
ERROR HY000: Incorrect usage of UNION and INTO
|
||||
|
||||
create procedure bugs3()
|
||||
begin
|
||||
select 2 into @v3 union select 2;
|
||||
end/
|
||||
ERROR HY000: Incorrect usage of UNION and INTO
|
||||
|
||||
create procedure bugs4()
|
||||
begin
|
||||
select 1 union select 2 into @v4;
|
||||
end/
|
||||
|
||||
call bugs4()/
|
||||
ERROR 42000: Result consisted of more than one row
|
||||
|
||||
### mysql inner_call support number to bool
|
||||
###
|
||||
DROP PROCEDURE IF EXISTS `pro_1`/
|
||||
DROP FUNCTION IF EXISTS `fun_2`/
|
||||
CREATE PROCEDURE pro_1(IN a1 INT ,IN a2 INT)
|
||||
BEGIN
|
||||
SELECT a1 + a2 INTO @p;
|
||||
END/
|
||||
CALL pro_1(TRUE,TRUE);/
|
||||
SELECT @p/
|
||||
+------+
|
||||
| @p |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
CREATE FUNCTION fun_2() RETURNS INT
|
||||
BEGIN
|
||||
DECLARE d1,d2 BOOLEAN;
|
||||
SET d1=1,d2=1;
|
||||
CALL pro_1(d1,d2);
|
||||
RETURN 1;
|
||||
END/
|
||||
SELECT fun_2()/
|
||||
+---------+
|
||||
| fun_2() |
|
||||
+---------+
|
||||
| 1 |
|
||||
+---------+
|
||||
SELECT @p/
|
||||
+------+
|
||||
| @p |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
DROP PROCEDURE IF EXISTS `pro_1`/
|
||||
DROP FUNCTION IF EXISTS `fun_2`/
|
||||
|
||||
drop procedure bugs1;
|
||||
drop procedure bugs4;
|
||||
|
||||
###
|
||||
drop procedure if exists alias_1;
|
||||
drop procedure if exists alias_2;
|
||||
|
||||
create procedure alias_1()
|
||||
begin
|
||||
select "hr\"fix\"issue" + 3 + "a";
|
||||
end/
|
||||
|
||||
call alias_1()/
|
||||
+--------------------------+
|
||||
| "hr"fix"issue" + 3 + "a" |
|
||||
+--------------------------+
|
||||
| 3 |
|
||||
+--------------------------+
|
||||
create procedure alias_2(in a int, inout b int, out c int)
|
||||
begin
|
||||
select a;
|
||||
select b+5;
|
||||
select a+b into c;
|
||||
select c;
|
||||
end/
|
||||
|
||||
set @b=5;/
|
||||
set @c=0;/
|
||||
|
||||
call alias_2(3, @b, @c)/
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
+------+
|
||||
| b+5 |
|
||||
+------+
|
||||
+------+
|
||||
| c |
|
||||
+------+
|
||||
| 3 |
|
||||
| 10 |
|
||||
| 8 |
|
||||
+------+
|
||||
+------+
|
||||
+------+
|
||||
|
||||
|
||||
drop procedure alias_1;
|
||||
drop procedure alias_2;
|
||||
|
||||
drop procedure if exists p2;
|
||||
drop procedure if exists p3;
|
||||
drop function if exists f2;
|
||||
drop table if exists t1;
|
||||
|
||||
drop procedure if exists p1;
|
||||
create procedure p1()
|
||||
begin
|
||||
select 1;
|
||||
end;
|
||||
|
||||
select "succ"//
|
||||
+------+
|
||||
| succ |
|
||||
+------+
|
||||
| succ |
|
||||
+------+
|
||||
|
||||
call p1()//
|
||||
+---+
|
||||
| 1 |
|
||||
+---+
|
||||
| 1 |
|
||||
+---+
|
||||
|
||||
select "===begin===";
|
||||
create procedure p2()
|
||||
begin
|
||||
select 2;
|
||||
end;
|
||||
|
||||
create procedure p3()
|
||||
begin
|
||||
select 3;
|
||||
end//
|
||||
+-------------+
|
||||
| ===begin=== |
|
||||
+-------------+
|
||||
| ===begin=== |
|
||||
+-------------+
|
||||
|
||||
call p2()//
|
||||
+---+
|
||||
| 2 |
|
||||
+---+
|
||||
| 2 |
|
||||
+---+
|
||||
call p3()//
|
||||
+---+
|
||||
| 3 |
|
||||
+---+
|
||||
| 3 |
|
||||
+---+
|
||||
|
||||
drop procedure p1;
|
||||
drop procedure p2;
|
||||
drop procedure p3;
|
||||
|
||||
select "===end==="//
|
||||
+-----------+
|
||||
| ===end=== |
|
||||
+-----------+
|
||||
| ===end=== |
|
||||
+-----------+
|
||||
|
||||
/*start with comment case;*/
|
||||
create procedure p1()
|
||||
begin
|
||||
select "first stmt";
|
||||
select "second stmt";
|
||||
end;
|
||||
/*insert a comment;*/
|
||||
create procedure p2()
|
||||
begin
|
||||
-- pl contain comment;
|
||||
select "pl contain comment";
|
||||
end;
|
||||
|
||||
call p1();
|
||||
call p2();
|
||||
drop procedure p1;
|
||||
drop procedure p2//
|
||||
+------------+
|
||||
| first stmt |
|
||||
+------------+
|
||||
+-------------+
|
||||
| second stmt |
|
||||
+-------------+
|
||||
+--------------------+
|
||||
| pl contain comment |
|
||||
+--------------------+
|
||||
| first stmt |
|
||||
| second stmt |
|
||||
| pl contain comment |
|
||||
+------------+
|
||||
+-------------+
|
||||
+--------------------+
|
||||
|
||||
create table t1(id int)//
|
||||
create procedure p1() insert into t1 values(1); insert into t1 values(2);//
|
||||
|
||||
call p1();
|
||||
select * from t1//
|
||||
+------+
|
||||
| id |
|
||||
+------+
|
||||
| 2 |
|
||||
| 1 |
|
||||
+------+
|
||||
|
||||
drop procedure p1;
|
||||
create procedure p1()
|
||||
begin
|
||||
insert into t1 values(1);
|
||||
/*insert value of 2;*/
|
||||
insert into t1 values(2);
|
||||
end;
|
||||
call p1();
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop procedure p1//
|
||||
+------+
|
||||
| id |
|
||||
+------+
|
||||
| 2 |
|
||||
| 1 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
create table t1(id int);
|
||||
drop table if exists t1;
|
||||
create function f2() returns int
|
||||
begin
|
||||
declare a int;
|
||||
return 1;
|
||||
end;//
|
||||
|
||||
select f2//
|
||||
+------+
|
||||
| f2 |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
|
||||
drop function f2//
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
result_format: 4
|
||||
|
||||
select "routine_name" as column_name, collation
|
||||
from oceanbase.__all_collation
|
||||
where id =
|
||||
(select collation_type
|
||||
from oceanbase.__all_column
|
||||
where table_id =
|
||||
(select table_id from oceanbase.__all_virtual_table where table_name = '__all_virtual_routine')
|
||||
and column_name = 'routine_name');
|
||||
+--------------+--------------------+
|
||||
| column_name | collation |
|
||||
+--------------+--------------------+
|
||||
| routine_name | utf8mb4_general_ci |
|
||||
+--------------+--------------------+
|
||||
|
||||
drop procedure if exists my_proc;
|
||||
create procedure my_proc() begin end;
|
||||
create procedure My_proc() begin end;
|
||||
ERROR 42000: PROCEDURE My_proc already exists
|
||||
create procedure MY_proc() begin end;
|
||||
ERROR 42000: PROCEDURE MY_proc already exists
|
||||
create procedure MY_PROC() begin end;
|
||||
ERROR 42000: PROCEDURE MY_PROC already exists
|
||||
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'my_proc' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_proc |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'My_proc' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_proc |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'MY_proc' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_proc |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'MY_PROC' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_proc |
|
||||
+--------------+
|
||||
|
||||
call my_proc();
|
||||
call My_proc();
|
||||
call MY_proc();
|
||||
call MY_PROC();
|
||||
|
||||
drop procedure my_proc;
|
||||
|
||||
drop function if exists my_func;
|
||||
create function my_func() returns int return 1;
|
||||
create function My_func() returns int return 1;
|
||||
ERROR 42000: FUNCTION My_func already exists
|
||||
create function MY_func() returns int return 1;
|
||||
ERROR 42000: FUNCTION MY_func already exists
|
||||
create function MY_FUNC() returns int return 1;
|
||||
ERROR 42000: FUNCTION MY_FUNC already exists
|
||||
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'my_func' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_func |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'My_func' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_func |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'MY_func' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_func |
|
||||
+--------------+
|
||||
select routine_name from oceanbase.__all_virtual_routine where routine_name = 'MY_FUNC' and tenant_id = effective_tenant_id();
|
||||
+--------------+
|
||||
| routine_name |
|
||||
+--------------+
|
||||
| my_func |
|
||||
+--------------+
|
||||
|
||||
select my_func();
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
select My_func();
|
||||
+-----------+
|
||||
| My_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
select MY_func();
|
||||
+-----------+
|
||||
| MY_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
select MY_FUNC();
|
||||
+-----------+
|
||||
| MY_FUNC() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
|
||||
drop function my_func;
|
||||
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
result_format: 4
|
||||
drop table if exists my_tab;
|
||||
drop procedure if exists my_proc;
|
||||
drop function if exists my_func;
|
||||
drop database if exists my_db;
|
||||
create table my_tab(col varchar(50));
|
||||
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
insert into my_tab values(concat("my_proc exec with db = ", database()));
|
||||
end|
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
insert into my_tab values(concat("my_func exec with db = ", database()));
|
||||
return 1;
|
||||
end|
|
||||
|
||||
|
||||
call my_proc();
|
||||
select my_func();
|
||||
+-----------+
|
||||
| my_func() |
|
||||
+-----------+
|
||||
| 1 |
|
||||
+-----------+
|
||||
select * from my_tab;
|
||||
+-----------------------------+
|
||||
| col |
|
||||
+-----------------------------+
|
||||
| my_proc exec with db = test |
|
||||
| my_func exec with db = test |
|
||||
+-----------------------------+
|
||||
|
||||
create database my_db;
|
||||
use my_db;
|
||||
call test.my_proc();
|
||||
select test.my_func();
|
||||
+----------------+
|
||||
| test.my_func() |
|
||||
+----------------+
|
||||
| 1 |
|
||||
+----------------+
|
||||
select * from test.my_tab;
|
||||
+-----------------------------+
|
||||
| col |
|
||||
+-----------------------------+
|
||||
| my_func exec with db = test |
|
||||
| my_func exec with db = test |
|
||||
| my_proc exec with db = test |
|
||||
| my_proc exec with db = test |
|
||||
+-----------------------------+
|
||||
|
||||
use test;
|
||||
drop procedure my_proc;
|
||||
drop function my_func;
|
||||
drop table my_tab;
|
||||
drop database my_db;
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
result_format: 4
|
||||
DROP TABLE IF EXISTS t4;
|
||||
CREATE TABLE t4 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
Member_ID varchar(15) NOT NULL default '',
|
||||
Action varchar(12) NOT NULL,
|
||||
Action_Date datetime NOT NULL,
|
||||
Track varchar(15) default NULL,
|
||||
User varchar(12) default NULL,
|
||||
Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update
|
||||
CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (ID),
|
||||
KEY Action (Action),
|
||||
KEY Action_Date (Action_Date)
|
||||
);
|
||||
|
||||
INSERT INTO t4(Member_ID, Action, Action_Date, Track) VALUES
|
||||
('111111', 'Disenrolled', '2006-03-01', 'CAD' ),
|
||||
('111111', 'Enrolled', '2006-03-01', 'CAD' ),
|
||||
('111111', 'Disenrolled', '2006-07-03', 'CAD' ),
|
||||
('222222', 'Enrolled', '2006-03-07', 'CAD' ),
|
||||
('222222', 'Enrolled', '2006-03-07', 'CHF' ),
|
||||
('222222', 'Disenrolled', '2006-08-02', 'CHF' ),
|
||||
('333333', 'Enrolled', '2006-03-01', 'CAD' ),
|
||||
('333333', 'Disenrolled', '2006-03-01', 'CAD' ),
|
||||
('444444', 'Enrolled', '2006-03-01', 'CAD' ),
|
||||
('555555', 'Disenrolled', '2006-03-01', 'CAD' ),
|
||||
('555555', 'Enrolled', '2006-07-21', 'CAD' ),
|
||||
('555555', 'Disenrolled', '2006-03-01', 'CHF' ),
|
||||
('666666', 'Enrolled', '2006-02-09', 'CAD' ),
|
||||
('666666', 'Enrolled', '2006-05-12', 'CHF' ),
|
||||
('666666', 'Disenrolled', '2006-06-01', 'CAD' );
|
||||
|
||||
DROP FUNCTION IF EXISTS my_func;
|
||||
CREATE FUNCTION my_func(col INT) RETURNS INT RETURN col;
|
||||
|
||||
|
||||
SELECT my_func(ID) FROM t4;
|
||||
+-------------+
|
||||
| my_func(ID) |
|
||||
+-------------+
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |
|
||||
| 4 |
|
||||
| 5 |
|
||||
| 6 |
|
||||
| 7 |
|
||||
| 8 |
|
||||
| 9 |
|
||||
| 10 |
|
||||
| 11 |
|
||||
| 12 |
|
||||
| 13 |
|
||||
| 14 |
|
||||
| 15 |
|
||||
+-------------+
|
||||
|
||||
DROP TABLE t4;
|
||||
DROP FUNCTION my_func;
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
result_format: 4
|
||||
use test;
|
||||
|
||||
CREATE FUNCTION my_func() returns int BEGIN create database my_db; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN alter database my_db read only; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN drop database my_db; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN create table my_tab(col int); return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN drop table my_tab; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN rename table my_tab to t2; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN truncate table my_tab; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN create view my_view as select 1; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN drop view my_view; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION my_func() returns int BEGIN create index my_idx on my_tab(col); return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
@ -0,0 +1,229 @@
|
||||
result_format: 4
|
||||
use test;
|
||||
|
||||
drop function if exists my_func;
|
||||
drop function if exists my_proc;
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
prepare stmt from "select 1";
|
||||
end |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
execute stmt;
|
||||
end |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
deallocate prepare stmt;
|
||||
end |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
select 1;
|
||||
end |
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
create function my_func() returns int
|
||||
begin
|
||||
call my_proc();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
prepare stmt from 'select 1';
|
||||
end |
|
||||
|
||||
select my_func() |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
drop procedure my_proc |
|
||||
create procedure my_proc()
|
||||
begin
|
||||
execute stmt;
|
||||
end |
|
||||
|
||||
select my_func() |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
drop procedure my_proc |
|
||||
create procedure my_proc()
|
||||
begin
|
||||
deallocate prepare stmt;
|
||||
end |
|
||||
|
||||
select my_func()|
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
drop procedure my_proc |
|
||||
create procedure my_proc()
|
||||
begin
|
||||
select 1;
|
||||
end |
|
||||
|
||||
select my_func() |
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
|
||||
drop procedure my_proc |
|
||||
create procedure my_proc()
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
|
||||
select my_func() |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
drop function my_func|
|
||||
drop procedure my_proc|
|
||||
|
||||
drop procedure if exists my_proc1 |
|
||||
drop procedure if exists my_proc2 |
|
||||
drop function if exists my_func1 |
|
||||
drop function if exists my_func2 |
|
||||
create function my_func1() returns int
|
||||
begin
|
||||
call my_proc1();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc1()
|
||||
begin
|
||||
call my_proc2();
|
||||
end |
|
||||
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
prepare stmt from 'select 1';
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
|
||||
|
||||
drop procedure my_proc2 |
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
select 1;
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
|
||||
drop procedure my_proc2 |
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
drop function my_func1 |
|
||||
drop procedure my_proc1 |
|
||||
drop procedure my_proc2 |
|
||||
|
||||
create procedure my_proc1()
|
||||
begin
|
||||
select my_func1();
|
||||
end |
|
||||
|
||||
create function my_func1() returns int
|
||||
begin
|
||||
call my_proc2();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
|
||||
call my_proc1() |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
drop procedure my_proc1|
|
||||
drop procedure my_proc2|
|
||||
drop function my_func1|
|
||||
|
||||
create function my_func1() returns int
|
||||
begin
|
||||
call my_proc1();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc1()
|
||||
begin
|
||||
call my_proc2();
|
||||
end |
|
||||
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
drop procedure my_proc1 |
|
||||
drop procedure my_proc2 |
|
||||
drop function my_func1 |
|
||||
|
||||
create function my_func1() returns int
|
||||
begin
|
||||
call my_proc1();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc1()
|
||||
begin
|
||||
select my_func2();
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
|
||||
drop function my_func1 |
|
||||
drop procedure my_proc1 |
|
||||
|
||||
create function my_func1() returns int
|
||||
begin
|
||||
call my_proc1();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc1()
|
||||
begin
|
||||
declare v int;
|
||||
select my_func2() into v;
|
||||
end |
|
||||
|
||||
create function my_func2() returns int
|
||||
begin
|
||||
call my_proc2();
|
||||
return 1;
|
||||
end |
|
||||
|
||||
create procedure my_proc2()
|
||||
begin
|
||||
create table my_tab(col int);
|
||||
end |
|
||||
|
||||
select my_func1() |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
||||
drop procedure my_proc1 |
|
||||
drop procedure my_proc2 |
|
||||
drop function my_func1 |
|
||||
drop function my_func2 |
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,249 @@
|
||||
result_format: 4
|
||||
drop table if exists a,b,t,t1;
|
||||
drop procedure if exists p;
|
||||
drop procedure if exists f;
|
||||
drop procedure if exists pp;
|
||||
|
||||
###test show procedure###
|
||||
create procedure f(x int)
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(x int)
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
create procedure f(inout x int)
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(inout x int)
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
create procedure f(out x int)
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(out x int)
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
create procedure f(x varchar(10))
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(x varchar(10))
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
create procedure f(x decimal(6,2))
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(x decimal(6,2))
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
create procedure f(x int, y varchar(10))
|
||||
begin
|
||||
end//
|
||||
show create procedure f;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
f STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `f`(x int, y varchar(10))
|
||||
begin
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure f;
|
||||
|
||||
###test mysql.proc###
|
||||
create procedure f(x int)
|
||||
begin
|
||||
end//
|
||||
create procedure p(x int)
|
||||
begin
|
||||
end//
|
||||
select
|
||||
db,
|
||||
name,
|
||||
type,
|
||||
specific_name,
|
||||
language,
|
||||
sql_data_access,
|
||||
is_deterministic,
|
||||
security_type,
|
||||
param_list,
|
||||
returns,
|
||||
body
|
||||
from mysql.proc
|
||||
where db = database() and (name = 'f' or name = 'p');
|
||||
+------+------+-----------+---------------+----------+-----------------+------------------+---------------+------------+---------+-----------+
|
||||
| db | name | type | specific_name | language | sql_data_access | is_deterministic | security_type | param_list | returns | body |
|
||||
+------+------+-----------+---------------+----------+-----------------+------------------+---------------+------------+---------+-----------+
|
||||
| test | f | PROCEDURE | f | SQL | CONTAINS_SQL | NO | DEFINER | x int | null | begin
|
||||
end |
|
||||
| test | p | PROCEDURE | p | SQL | CONTAINS_SQL | NO | DEFINER | x int | null | begin
|
||||
end |
|
||||
+------+------+-----------+---------------+----------+-----------------+------------------+---------------+------------+---------+-----------+
|
||||
drop procedure f;
|
||||
drop procedure p;
|
||||
|
||||
## 测试dbms_metadata.get_ddl返回值不会出现超长,pl具体内容没有意义
|
||||
drop procedure if exists CASE29;
|
||||
CREATE PROCEDURE CASE29 (
|
||||
ID1 int,
|
||||
STR1 varchar(100),
|
||||
ID2 int,
|
||||
STR2 varchar(100),
|
||||
ID3 int,
|
||||
STR3 varchar(100)
|
||||
)
|
||||
begin
|
||||
declare a31 int;
|
||||
declare a32 char(255);
|
||||
declare a33 varchar(4000);
|
||||
declare a34 varchar(10000);
|
||||
declare a35 varchar(10000);
|
||||
declare a36 date;
|
||||
declare a37 timestamp;
|
||||
declare a38 int;
|
||||
declare a39 integer;
|
||||
declare a40 varchar(10000);
|
||||
declare a41 int;
|
||||
declare a42 char(255);
|
||||
declare a43 varchar(4000);
|
||||
declare a44 varchar(10000);
|
||||
declare a45 varchar(10000);
|
||||
declare a46 date;
|
||||
declare a47 timestamp;
|
||||
declare a48 int;
|
||||
declare a49 integer;
|
||||
declare a51 int;
|
||||
declare a52 char(255);
|
||||
declare a53 varchar(4000);
|
||||
declare a54 varchar(10000);
|
||||
declare a55 varchar(10000);
|
||||
declare a56 date;
|
||||
declare a57 timestamp;
|
||||
declare a58 int;
|
||||
declare a59 integer;
|
||||
|
||||
set a31=ID1;
|
||||
set a32='dsfsafsadfasdfsadfasdfsdfasfew';
|
||||
set a33=STR1;
|
||||
set a34='aefwfsdafdsfasdfffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3wef2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeawecwefaewwacfsfweafasdfwefawefwfasdcafwvfawevfawefaweffas';
|
||||
set a35='2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345fff2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaef43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae';
|
||||
set a36='2018-05-30 01:01:59';
|
||||
set a37='3029-09-09 11:34:23.231231';
|
||||
set a38=3432123;
|
||||
set a39=123123;
|
||||
|
||||
|
||||
set a40='ffsdcv4ffffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3wesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3';
|
||||
|
||||
|
||||
set a51=ID3;
|
||||
set a52='dfgdsfgdsafa';
|
||||
set a53=STR3;
|
||||
set a54='asfw3dfsf2343255ffffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3f2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaewfaf';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a56='1000-01-01 00:12:21';
|
||||
set a57='2000-01-01 23:59:59.999999';
|
||||
set a58=12154;
|
||||
set a59=215425415;
|
||||
|
||||
end
|
||||
//
|
||||
|
||||
show create procedure CASE29;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
CASE29 STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER CREATE DEFINER = `admin`@`%` PROCEDURE `CASE29`(
|
||||
ID1 int,
|
||||
STR1 varchar(100),
|
||||
ID2 int,
|
||||
STR2 varchar(100),
|
||||
ID3 int,
|
||||
STR3 varchar(100)
|
||||
)
|
||||
begin
|
||||
declare a31 int;
|
||||
declare a32 char(255);
|
||||
declare a33 varchar(4000);
|
||||
declare a34 varchar(10000);
|
||||
declare a35 varchar(10000);
|
||||
declare a36 date;
|
||||
declare a37 timestamp;
|
||||
declare a38 int;
|
||||
declare a39 integer;
|
||||
declare a40 varchar(10000);
|
||||
declare a41 int;
|
||||
declare a42 char(255);
|
||||
declare a43 varchar(4000);
|
||||
declare a44 varchar(10000);
|
||||
declare a45 varchar(10000);
|
||||
declare a46 date;
|
||||
declare a47 timestamp;
|
||||
declare a48 int;
|
||||
declare a49 integer;
|
||||
declare a51 int;
|
||||
declare a52 char(255);
|
||||
declare a53 varchar(4000);
|
||||
declare a54 varchar(10000);
|
||||
declare a55 varchar(10000);
|
||||
declare a56 date;
|
||||
declare a57 timestamp;
|
||||
declare a58 int;
|
||||
declare a59 integer;
|
||||
|
||||
set a31=ID1;
|
||||
set a32='dsfsafsadfasdfsadfasdfsdfasfew';
|
||||
set a33=STR1;
|
||||
set a34='aefwfsdafdsfasdfffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3wef2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeawecwefaewwacfsfweafasdfwefawefwfasdcafwvfawevfawefaweffas';
|
||||
set a35='2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345fff2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaef43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae';
|
||||
set a36='2018-05-30 01:01:59';
|
||||
set a37='3029-09-09 11:34:23.231231';
|
||||
set a38=3432123;
|
||||
set a39=123123;
|
||||
|
||||
|
||||
set a40='ffsdcv4ffffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3wesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3';
|
||||
|
||||
|
||||
set a51=ID3;
|
||||
set a52='dfgdsfgdsafa';
|
||||
set a53=STR3;
|
||||
set a54='asfw3dfsf2343255ffffsdcv4ffwesdfaf2343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaeafwaefasfawefawfwaeff3f2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aaewfaf';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a55='14545752154fff3562ade24524534563654765865970954736212343255fffffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff2115436345235234643572562eead546546795656123452bdae44326578567722343255fff2115436345235234643572562eead546546795656123452bdaeffff23452345234563452345ffff43253245232343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae45ff32322342135432311aabc668fff546263245345123453461452345ffff442343255fff2115436345235234643572562eead546546795656123452bdae4432657856772345adebcffffade3467abc62aae32657856772345adebcffffade3467abc62aae345adebcffffade3467abc62aae425367899855432145678985432eeeeffffaaaabbbbbaaedbc2456454';
|
||||
set a56='1000-01-01 00:12:21';
|
||||
set a57='2000-01-01 23:59:59.999999';
|
||||
set a58=12154;
|
||||
set a59=215425415;
|
||||
|
||||
end utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
|
||||
DROP PROCEDURE CASE29;
|
||||
@ -0,0 +1,251 @@
|
||||
result_format: 4
|
||||
#### Case 1:
|
||||
drop procedure if exists test_proc;
|
||||
drop table if exists result;
|
||||
create table result(col varchar(20));
|
||||
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set @id = @id + 1;
|
||||
insert into result values(@id);
|
||||
end;
|
||||
/
|
||||
|
||||
|
||||
call test_proc();
|
||||
select col from result;
|
||||
+------+
|
||||
| col |
|
||||
+------+
|
||||
| NULL |
|
||||
+------+
|
||||
|
||||
drop procedure test_proc;
|
||||
drop table result;
|
||||
|
||||
#### Case 1:
|
||||
drop procedure if exists test_proc;
|
||||
drop table if exists result;
|
||||
set @id = 2.00000;
|
||||
create table result(col varchar(20));
|
||||
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set @id = @id + 1;
|
||||
insert into result values(@id);
|
||||
end;
|
||||
/
|
||||
|
||||
|
||||
call test_proc();
|
||||
select col from result;
|
||||
+---------+
|
||||
| col |
|
||||
+---------+
|
||||
| 3.00000 |
|
||||
+---------+
|
||||
|
||||
drop procedure test_proc;
|
||||
drop table result;
|
||||
|
||||
#### Case 2:
|
||||
drop procedure if exists test_proc;
|
||||
drop table if exists result;
|
||||
create table result (x varchar(20), y int, z double);
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
declare x varchar(20);
|
||||
declare y int default 0;
|
||||
declare z double;
|
||||
set @a = 'ON';
|
||||
set x = @a;
|
||||
set @a = 1;
|
||||
set y = @a;
|
||||
set @a = 1.23456;
|
||||
set z = @a;
|
||||
-- select x, y, z;
|
||||
insert into result values(x, y, z);
|
||||
end;
|
||||
/
|
||||
|
||||
call test_proc();
|
||||
select * from result;
|
||||
+------+------+---------+
|
||||
| x | y | z |
|
||||
+------+------+---------+
|
||||
| ON | 1 | 1.23456 |
|
||||
+------+------+---------+
|
||||
call test_proc();
|
||||
drop table result;
|
||||
drop procedure test_proc;
|
||||
|
||||
#### Case 3:
|
||||
drop procedure if exists test_proc;
|
||||
drop table if exists result;
|
||||
create table result(x varchar(20), y int, z double);
|
||||
create procedure test_proc()
|
||||
begin
|
||||
declare y int;
|
||||
declare z double default null;
|
||||
set y = @n;
|
||||
set @n = 'on';
|
||||
insert into result values('0', y, z);
|
||||
end;
|
||||
/
|
||||
|
||||
call test_proc();
|
||||
select * from result;
|
||||
+------+------+------+
|
||||
| x | y | z |
|
||||
+------+------+------+
|
||||
| 0 | NULL | NULL |
|
||||
+------+------+------+
|
||||
call test_proc();
|
||||
ERROR HY000: Incorrect integer value
|
||||
|
||||
drop table result;
|
||||
drop procedure test_proc;
|
||||
|
||||
|
||||
#### Case 4:
|
||||
drop procedure if exists test_proc;
|
||||
set @save_autocommit = @@autocommit;
|
||||
|
||||
set global autocommit=on;
|
||||
set @@autocommit=on;
|
||||
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set autocommit = off;
|
||||
end;
|
||||
/
|
||||
call test_proc();
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
|
||||
drop procedure test_proc;
|
||||
|
||||
#### Case 5:
|
||||
drop procedure if exists test_proc;
|
||||
set global autocommit=on;
|
||||
set @@autocommit=on;
|
||||
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set @@autocommit = off;
|
||||
end;
|
||||
/
|
||||
|
||||
call test_proc();
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
|
||||
drop procedure test_proc;
|
||||
|
||||
#### Case 6:
|
||||
drop procedure if exists test_proc;
|
||||
set global autocommit=on;
|
||||
set @@autocommit=on;
|
||||
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set session autocommit = off;
|
||||
end;
|
||||
/
|
||||
call test_proc();
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
|
||||
drop procedure test_proc;
|
||||
|
||||
#### Case 7:
|
||||
drop procedure if exists test_proc;
|
||||
set global autocommit=on;
|
||||
set @@autocommit=on;
|
||||
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
|
||||
create procedure test_proc()
|
||||
begin
|
||||
set global autocommit = off;
|
||||
end;
|
||||
/
|
||||
call test_proc();
|
||||
show variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
show global variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit OFF
|
||||
show session variables like 'autocommit';
|
||||
Variable_name Value
|
||||
autocommit ON
|
||||
|
||||
set session autocommit = @save_autocommit;
|
||||
set global autocommit = @save_autocommit;
|
||||
|
||||
drop procedure test_proc;
|
||||
|
||||
|
||||
@ -0,0 +1,344 @@
|
||||
result_format: 4
|
||||
|
||||
drop table if exists result;/
|
||||
drop procedure if exists my_proc;/
|
||||
#### Case 1: int
|
||||
create table result(col1 int, col2 int, col3 int);/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 int default 10;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+------+------+------+
|
||||
| col1 | col2 | col3 |
|
||||
+------+------+------+
|
||||
| 10 | 10 | 10 |
|
||||
+------+------+------+
|
||||
|
||||
#### Case 2: bigint
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 bigint, col2 bigint, col3 bigint);/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 bigint default 10;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+------+------+------+
|
||||
| col1 | col2 | col3 |
|
||||
+------+------+------+
|
||||
| 10 | 10 | 10 |
|
||||
+------+------+------+
|
||||
|
||||
#### Case 3: tinyint
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 tinyint, col2 tinyint, col3 tinyint);/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 tinyint default 10;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+------+------+------+
|
||||
| col1 | col2 | col3 |
|
||||
+------+------+------+
|
||||
| 10 | 10 | 10 |
|
||||
+------+------+------+
|
||||
|
||||
#### Case 4: decimal
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 decimal(64,2), col2 decimal(64,2), col3 decimal(64,2));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 decimal(64,2) default 12.123;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+-------+-------+-------+
|
||||
| col1 | col2 | col3 |
|
||||
+-------+-------+-------+
|
||||
| 12.12 | 12.12 | 12.12 |
|
||||
+-------+-------+-------+
|
||||
|
||||
#### Case 5: bit
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 bit(3), col2 bit(3), col3 bit(3));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 bit(3) default b'101';
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select hex(col1), hex(col2), hex(col3) from result;/
|
||||
+-----------+-----------+-----------+
|
||||
| hex(col1) | hex(col2) | hex(col3) |
|
||||
+-----------+-----------+-----------+
|
||||
| 5 | 5 | 5 |
|
||||
+-----------+-----------+-----------+
|
||||
|
||||
#### Case 6: bit angin
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 bit(8), col2 bit(8), col3 bit(8));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 bit(8) default 128;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select hex(col1), hex(col2), hex(col3) from result;/
|
||||
+-----------+-----------+-----------+
|
||||
| hex(col1) | hex(col2) | hex(col3) |
|
||||
+-----------+-----------+-----------+
|
||||
| 80 | 80 | 80 |
|
||||
+-----------+-----------+-----------+
|
||||
|
||||
#### Case 7: char
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 char(10), col2 char(10), col3 char(10));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 char(10) default 'abcdef';
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+--------+--------+--------+
|
||||
| col1 | col2 | col3 |
|
||||
+--------+--------+--------+
|
||||
| abcdef | abcdef | abcdef |
|
||||
+--------+--------+--------+
|
||||
|
||||
#### Case 8: binary
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 binary(2), col2 binary(2), col3 binary(2));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 binary(2) default 0x41;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+------+------+------+
|
||||
| col1 | col2 | col3 |
|
||||
+------+------+------+
|
||||
| A | A | A |
|
||||
+------+------+------+
|
||||
|
||||
#### Case 9: varbinary
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 varbinary(2), col2 varbinary(2), col3 varbinary(2));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 varbinary(2) default 0x42;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+------+------+------+
|
||||
| col1 | col2 | col3 |
|
||||
+------+------+------+
|
||||
| B | B | B |
|
||||
+------+------+------+
|
||||
|
||||
#### Case 10: varchar
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 varchar(20), col2 varchar(20), col3 varchar(20));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 varchar(20) default 'x1234567';
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
select * from result;/
|
||||
+----------+----------+----------+
|
||||
| col1 | col2 | col3 |
|
||||
+----------+----------+----------+
|
||||
| x1234567 | x1234567 | x1234567 |
|
||||
+----------+----------+----------+
|
||||
|
||||
#### Case 11: no default value
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 varchar(20), col2 varchar(20), col3 varchar(20));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 varchar(20);
|
||||
insert into result values(col1, col2, col3);
|
||||
set col1 = 'col1';
|
||||
set col2 = 'col2';
|
||||
set col3 = 'col3';
|
||||
insert into result values(col1, col2, col3);
|
||||
set col1 = concat(col2, col3);
|
||||
set col2 = concat(col3, 'col1');
|
||||
set col3 = concat('col2', 'col2');
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
call my_proc()/
|
||||
|
||||
select * from result; /
|
||||
+----------+----------+----------+
|
||||
| col1 | col2 | col3 |
|
||||
+----------+----------+----------+
|
||||
| NULL | NULL | NULL |
|
||||
| col1 | col2 | col3 |
|
||||
| col2col3 | col3col1 | col2col2 |
|
||||
+----------+----------+----------+
|
||||
|
||||
#### Case 11: no default value
|
||||
drop procedure my_proc;/
|
||||
drop table result;/
|
||||
|
||||
create table result(col1 bit(3), col2 bit(3), col3 bit(3));/
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare col1, col2, col3 bit(3);
|
||||
insert into result values(col1, col2, col3);
|
||||
set col1 = b'101';
|
||||
set col2 = b'101';
|
||||
set col3 = b'101';
|
||||
insert into result values(col1, col2, col3);
|
||||
set col1 = col2;
|
||||
set col2 = col3;
|
||||
set col3 = col1;
|
||||
insert into result values(col1, col2, col3);
|
||||
end;
|
||||
/
|
||||
call my_proc()/
|
||||
|
||||
select hex(col1), hex(col2), hex(col3) from result; /
|
||||
+-----------+-----------+-----------+
|
||||
| hex(col1) | hex(col2) | hex(col3) |
|
||||
+-----------+-----------+-----------+
|
||||
| 5 | 5 | 5 |
|
||||
| 5 | 5 | 5 |
|
||||
| NULL | NULL | NULL |
|
||||
+-----------+-----------+-----------+
|
||||
|
||||
#### Case 12: out parameter
|
||||
drop procedure my_proc;/
|
||||
create procedure my_proc(OUT a int) begin end/
|
||||
set @a=1;
|
||||
call my_proc(@a)/
|
||||
select @a/
|
||||
+------+
|
||||
| @a |
|
||||
+------+
|
||||
| NULL |
|
||||
+------+
|
||||
|
||||
#### Case 13: enum set
|
||||
drop procedure my_proc;/
|
||||
drop table result; /
|
||||
create table result(x1 enum('x', 'y', 'z'),
|
||||
y1 enum('x', 'y', 'z'),
|
||||
z1 enum('x', 'y', 'z'),
|
||||
x2 set('x', 'y', 'z'),
|
||||
y2 set('x', 'y', 'z'),
|
||||
z2 set('x', 'y', 'z')); /
|
||||
|
||||
create procedure my_proc()
|
||||
begin
|
||||
declare x1, y1, z1 enum('x', 'y', 'z') default 'x';
|
||||
declare x2, y2, z2 set('x', 'y', 'z') default 'z';
|
||||
insert into result values(x1, y1, z1, x2, y2, z2);
|
||||
set y1 = 'y';
|
||||
set z1 = 'z';
|
||||
set x2 = 'x';
|
||||
set y2 = 'y';
|
||||
insert into result values(x1, y1, z1, x2, y2, z2);
|
||||
set x1 = y2;
|
||||
set z2 = y1;
|
||||
insert into result values(x1, y1, z1, x2, y2, z2);
|
||||
end;
|
||||
/
|
||||
|
||||
call my_proc()/
|
||||
|
||||
select * from result;
|
||||
/
|
||||
+------+------+------+------+------+------+
|
||||
| x1 | y1 | z1 | x2 | y2 | z2 |
|
||||
+------+------+------+------+------+------+
|
||||
| x | x | x | z | z | z |
|
||||
| x | y | z | x | y | z |
|
||||
| y | y | z | x | y | y |
|
||||
+------+------+------+------+------+------+
|
||||
|
||||
#### Case 14: enum set
|
||||
drop procedure my_proc/
|
||||
create procedure my_proc(out z varchar(20))
|
||||
begin
|
||||
declare x enum('1', '2') default '1';
|
||||
declare y enum('2', '3') default '2';
|
||||
set x = y;
|
||||
set z = x;
|
||||
end;
|
||||
/
|
||||
call my_proc(@z)/
|
||||
select @z;/
|
||||
+------+
|
||||
| @z |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
#### clean
|
||||
drop procedure my_proc/
|
||||
drop table result;/
|
||||
@ -0,0 +1,101 @@
|
||||
result_format: 4
|
||||
drop procedure if exists test.longprocedure;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
|
||||
|
||||
+--------+
|
||||
| length |
|
||||
+--------+
|
||||
| 3500 |
|
||||
+--------+
|
||||
|
||||
select length(routine_definition) from information_schema.routines where routine_schema = 'test' and routine_name = 'longprocedure';
|
||||
+----------------------------+
|
||||
| length(routine_definition) |
|
||||
+----------------------------+
|
||||
| 3512 |
|
||||
+----------------------------+
|
||||
|
||||
set ob_query_timeout=10000000000;
|
||||
set ob_trx_timeout=10000000000;
|
||||
call test.longprocedure(@value);
|
||||
select @value;
|
||||
+--------+
|
||||
| @value |
|
||||
+--------+
|
||||
| 3 |
|
||||
+--------+
|
||||
set ob_query_timeout=default;
|
||||
set ob_trx_timeout=default;
|
||||
|
||||
drop procedure test.longprocedure;
|
||||
drop table t1;
|
||||
create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
|
||||
insert into t1 (f1, f2, f3, f4, f5) values
|
||||
("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
|
||||
create table t2 like t1;
|
||||
select count(*) from t1;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 256 |
|
||||
+----------+
|
||||
select count(*) from t2;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 0 |
|
||||
+----------+
|
||||
drop procedure if exists p1;
|
||||
create procedure p1()
|
||||
begin
|
||||
declare done integer default 0;
|
||||
declare vf1 char(100) ;
|
||||
declare vf2 mediumint;
|
||||
declare vf3 int ;
|
||||
declare vf4 real ;
|
||||
declare vf5 numeric ;
|
||||
declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open cur1;
|
||||
while done <> 1 do
|
||||
fetch cur1 into vf1, vf2, vf3, vf4, vf5;
|
||||
if not done then
|
||||
insert into t2 values (vf1, vf2, vf3, vf4, vf5);
|
||||
end if;
|
||||
end while;
|
||||
close cur1;
|
||||
end|
|
||||
set ob_query_timeout=10000000000;
|
||||
set ob_trx_timeout=10000000000;
|
||||
call p1();
|
||||
set ob_query_timeout=default;
|
||||
set ob_trx_timeout=default;
|
||||
select count(*) from t1;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 256 |
|
||||
+----------+
|
||||
select count(*) from t2;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 256 |
|
||||
+----------+
|
||||
select f1 from t1 limit 1;
|
||||
+--------------------------------------+
|
||||
| f1 |
|
||||
+--------------------------------------+
|
||||
| This is a test case for for Bug#9819 |
|
||||
+--------------------------------------+
|
||||
select f1 from t2 limit 1;
|
||||
+--------------------------------------+
|
||||
| f1 |
|
||||
+--------------------------------------+
|
||||
| This is a test case for for Bug#9819 |
|
||||
+--------------------------------------+
|
||||
drop procedure p1;
|
||||
drop table t1, t2;
|
||||
@ -0,0 +1,454 @@
|
||||
result_format: 4
|
||||
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 ()
|
||||
begin
|
||||
drop table if exists t1;
|
||||
select 1 as "my-col";
|
||||
end;
|
||||
//
|
||||
|
||||
select database();
|
||||
+------------+
|
||||
| database() |
|
||||
+------------+
|
||||
| mysqltest |
|
||||
+------------+
|
||||
call sp1();
|
||||
+--------+
|
||||
| my-col |
|
||||
+--------+
|
||||
| 1 |
|
||||
+--------+
|
||||
select database();
|
||||
+------------+
|
||||
| database() |
|
||||
+------------+
|
||||
| mysqltest |
|
||||
+------------+
|
||||
|
||||
use test;
|
||||
select database();
|
||||
+------------+
|
||||
| database() |
|
||||
+------------+
|
||||
| test |
|
||||
+------------+
|
||||
call mysqltest.sp1();
|
||||
+--------+
|
||||
| my-col |
|
||||
+--------+
|
||||
| 1 |
|
||||
+--------+
|
||||
select database();
|
||||
+------------+
|
||||
| database() |
|
||||
+------------+
|
||||
| test |
|
||||
+------------+
|
||||
|
||||
drop procedure mysqltest.sp1;
|
||||
drop database mysqltest;
|
||||
|
||||
create procedure sp1()
|
||||
begin
|
||||
create table t1 (a int);
|
||||
insert into t1 values (10);
|
||||
end//
|
||||
|
||||
create procedure sp2()
|
||||
begin
|
||||
create table t2(a int);
|
||||
insert into t2 values(1);
|
||||
call sp1();
|
||||
end//
|
||||
|
||||
create function f1() returns int
|
||||
begin
|
||||
declare v int default 0;
|
||||
select max(a) from t1 into v;
|
||||
return v;
|
||||
## 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 | a |
|
||||
+----+------+
|
||||
| t1 | 10 |
|
||||
+----+------+
|
||||
|
||||
drop table t1;
|
||||
call sp2();
|
||||
select 't1',a from t1;
|
||||
+----+------+
|
||||
| t1 | a |
|
||||
+----+------+
|
||||
| t1 | 10 |
|
||||
+----+------+
|
||||
select 't2',a from t2;
|
||||
+----+------+
|
||||
| t2 | a |
|
||||
+----+------+
|
||||
| t2 | 1 |
|
||||
+----+------+
|
||||
drop table t1, t2;
|
||||
|
||||
call sp3();
|
||||
+------+------+
|
||||
| func | f1() |
|
||||
+------+------+
|
||||
| func | 10 |
|
||||
+------+------+
|
||||
select 't1',a from t1;
|
||||
+----+------+
|
||||
| t1 | a |
|
||||
+----+------+
|
||||
| t1 | 10 |
|
||||
+----+------+
|
||||
|
||||
drop table t1;
|
||||
|
||||
drop procedure sp1;
|
||||
drop procedure sp2;
|
||||
drop procedure sp3;
|
||||
drop function f1;
|
||||
|
||||
## delimiter //;
|
||||
## create procedure sp1()
|
||||
## begin
|
||||
## create temporary table t2(a int);
|
||||
## insert into t2 select * from t1;
|
||||
## end//
|
||||
##
|
||||
## create procedure sp2()
|
||||
## begin
|
||||
## create 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//
|
||||
##
|
||||
## delimiter ;//
|
||||
## call sp2();
|
||||
## drop 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)
|
||||
begin
|
||||
select a;
|
||||
end //
|
||||
|
||||
create function f1() returns int
|
||||
begin
|
||||
declare v int default 0;
|
||||
select max(a) from t1 into v;
|
||||
return v;
|
||||
## return (select max(a) from t1);
|
||||
end //
|
||||
|
||||
|
||||
CALL sp1(f1());
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
#############
|
||||
create procedure sp2(a int)
|
||||
begin
|
||||
select * 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();
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 5 |
|
||||
+------+
|
||||
+------+
|
||||
+------+
|
||||
+------+
|
||||
|
||||
drop 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 int
|
||||
begin
|
||||
declare i int;
|
||||
select max(a) from t1 where a < ab into i;
|
||||
## set i= (select max(a) from t1 where a < ab) ;
|
||||
return i;
|
||||
end //
|
||||
|
||||
create function f2(ab int) returns int
|
||||
begin
|
||||
declare i int;
|
||||
select max(a) from t2 where a < ab into i;
|
||||
## 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 z
|
||||
from t3, t4 where t3.a = t4.a //
|
||||
|
||||
## create procedure sp1()
|
||||
## begin
|
||||
## declare a int;
|
||||
## ## 嵌套事务
|
||||
## select f1(4) + count(*) A from t1, v1 into a;
|
||||
## ## set a= (select f1(4) + count(*) A from t1, v1);
|
||||
## end //
|
||||
|
||||
## create function f3() returns int
|
||||
## begin
|
||||
## call sp1();
|
||||
## return 1;
|
||||
## end //
|
||||
## call sp1() //
|
||||
## select f3() //
|
||||
## select f3() //
|
||||
## call sp1() //
|
||||
## drop procedure sp1//
|
||||
## drop function f3//
|
||||
create procedure sp1()
|
||||
begin
|
||||
declare x int;
|
||||
declare c cursor for select count(*) from v1;
|
||||
## declare c cursor for select f1(3) + count(*) from v1;
|
||||
open c;
|
||||
fetch c into x;
|
||||
end;//
|
||||
|
||||
create function f3() returns int
|
||||
begin
|
||||
call sp1();
|
||||
return 1;
|
||||
end //
|
||||
|
||||
call sp1() //
|
||||
call sp1() //
|
||||
|
||||
select f3() //
|
||||
+------+
|
||||
| f3() |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
call 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 bigint
|
||||
begin
|
||||
declare v bigint default 0;
|
||||
select count(*) from v3 into v;
|
||||
return v;
|
||||
## return (select count(*) from v3);
|
||||
end|
|
||||
|
||||
prepare stmt from "select bug15683()";
|
||||
execute stmt;
|
||||
+------------+
|
||||
| bug15683() |
|
||||
+------------+
|
||||
| 2 |
|
||||
+------------+
|
||||
execute stmt;
|
||||
+------------+
|
||||
| bug15683() |
|
||||
+------------+
|
||||
| 2 |
|
||||
+------------+
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
drop view v1, v2, v3;
|
||||
drop function bug15683;
|
||||
|
||||
## --disable_warnings
|
||||
## drop table if exists t1, t2, t3;
|
||||
## drop function if exists bug19634;
|
||||
## --enable_warnings
|
||||
## create table t1 (id int, data int);
|
||||
## create table t2 (id int);
|
||||
## create table t3 (data int);
|
||||
## create function bug19634() returns int return (select count(*) from t3);
|
||||
## prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id and bug19634()";
|
||||
## # This should not crash server
|
||||
## execute stmt;
|
||||
## execute stmt;
|
||||
## deallocate prepare stmt;
|
||||
##
|
||||
## create trigger t1_bi before delete on t1 for each row insert into t3 values (old.data);
|
||||
## prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id";
|
||||
##
|
||||
## execute stmt;
|
||||
## execute stmt;
|
||||
## deallocate prepare stmt;
|
||||
##
|
||||
## drop function bug19634;
|
||||
## drop table t1, t2, t3;
|
||||
## --disable_warnings
|
||||
## drop table if exists bug_27907_logs;
|
||||
## drop table if exists bug_27907_t1;
|
||||
## --enable_warnings
|
||||
##
|
||||
## create table bug_27907_logs (a int);
|
||||
## create table bug_27907_t1 (a int);
|
||||
##
|
||||
## delimiter |;
|
||||
##
|
||||
## create trigger bug_27907_t1_ai after insert on bug_27907_t1
|
||||
## for each row
|
||||
## begin
|
||||
## insert into bug_27907_logs (a) values (1);
|
||||
## end|
|
||||
##
|
||||
## delimiter ;|
|
||||
##
|
||||
## drop table bug_27907_logs;
|
||||
##
|
||||
## #
|
||||
## # was failing before with error ER_NOT_LOCKED
|
||||
## #
|
||||
## --error ER_NO_SUCH_TABLE
|
||||
## insert into bug_27907_t1(a) values (1);
|
||||
##
|
||||
## drop table bug_27907_t1;
|
||||
|
||||
Bug#22427 create table if not exists + stored function results in
|
||||
inconsistent behavior
|
||||
|
||||
Add a test case, the bug itself was fixed by the patch for
|
||||
Bug#20662
|
||||
|
||||
drop table if exists t1;
|
||||
drop function if exists f_bug22427;
|
||||
create table t1 (i int);
|
||||
insert into t1 values (1);
|
||||
|
||||
create function f_bug22427() returns int
|
||||
begin
|
||||
declare v int default 0;
|
||||
select max(i) from t1 into v;
|
||||
return v;
|
||||
## return (select max(i) from t1);
|
||||
end|
|
||||
|
||||
select f_bug22427();
|
||||
+--------------+
|
||||
| f_bug22427() |
|
||||
+--------------+
|
||||
| 1 |
|
||||
+--------------+
|
||||
## 嵌套事务
|
||||
## create table if not exists t1 select f_bug22427() as i;
|
||||
## --error ER_TABLE_EXISTS_ERROR
|
||||
## create table t1 select f_bug22427() as i;
|
||||
## drop table t1;
|
||||
drop function f_bug22427;
|
||||
|
||||
## --echo #
|
||||
## --echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
|
||||
## --echo #
|
||||
## --disable_warnings
|
||||
## DROP table IF EXISTS t1,t2;
|
||||
## --enable_warnings
|
||||
## CREATE TABLE t1 (c1 INT);
|
||||
## CREATE TABLE t2 (c2 INT);
|
||||
## INSERT INTO t1 VALUES (1);
|
||||
## INSERT INTO t2 VALUES (2);
|
||||
## DELIMITER //;
|
||||
## CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
|
||||
## BEGIN
|
||||
## UPDATE t2 SET c2= c2 + 1;
|
||||
## END//
|
||||
## DELIMITER ;//
|
||||
## --echo # Take a table lock on t1.
|
||||
## --echo # This should pre-lock t2 through the trigger.
|
||||
## LOCK TABLE t1 WRITE;
|
||||
## INSERT INTO t1 VALUES (3);
|
||||
## UNLOCK TABLES;
|
||||
## LOCK TABLE t1 READ;
|
||||
## --error ER_TABLE_NOT_LOCKED
|
||||
## INSERT INTO t2 values(4);
|
||||
## UNLOCK TABLES;
|
||||
## SELECT * FROM t1;
|
||||
## SELECT * FROM t2;
|
||||
## DROP TRIGGER t1_ai;
|
||||
## DROP TABLE t1, t2;
|
||||
##
|
||||
## --echo End of 5.0 tests
|
||||
@ -0,0 +1,42 @@
|
||||
result_format: 4
|
||||
use test;
|
||||
|
||||
drop function if exists a;
|
||||
drop function if exists add;
|
||||
drop function if exists sub;
|
||||
create function a() returns int
|
||||
return 1;
|
||||
|
||||
create function upper() returns int
|
||||
return 2;
|
||||
|
||||
create function lower() returns int
|
||||
return 3;
|
||||
|
||||
select a();
|
||||
+------+
|
||||
| a() |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
select upper();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'upper'
|
||||
select lower();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'lower'
|
||||
select upper('a'), lower('B');
|
||||
+------------+------------+
|
||||
| upper('a') | lower('B') |
|
||||
+------------+------------+
|
||||
| A | b |
|
||||
+------------+------------+
|
||||
|
||||
select test.a(), test.upper(), test.lower();
|
||||
+----------+--------------+--------------+
|
||||
| test.a() | test.upper() | test.lower() |
|
||||
+----------+--------------+--------------+
|
||||
| 1 | 2 | 3 |
|
||||
+----------+--------------+--------------+
|
||||
drop function a;
|
||||
drop function upper;
|
||||
drop function lower;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,247 @@
|
||||
result_format: 4
|
||||
DROP PROCEDURE IF EXISTS proc_19194_codegen;
|
||||
DROP PROCEDURE IF EXISTS bug_19194_simple;
|
||||
DROP PROCEDURE IF EXISTS bug_19194_searched;
|
||||
|
||||
CREATE PROCEDURE proc_19194_codegen(
|
||||
IN proc_name VARCHAR(50)
|
||||
, IN count_v INTEGER
|
||||
, IN simple INTEGER
|
||||
, OUT body VARBINARY(65535)
|
||||
)
|
||||
BEGIN
|
||||
DECLARE code VARBINARY(65535);
|
||||
DECLARE i INT DEFAULT 1;
|
||||
|
||||
SET code = concat("CREATE PROCEDURE ", proc_name, "(i INT)\n");
|
||||
SET code = concat(code, "BEGIN\n");
|
||||
SET code = concat(code, " DECLARE str CHAR(10);\n");
|
||||
|
||||
IF (simple)
|
||||
THEN
|
||||
SET code = concat(code, " CASE i\n");
|
||||
ELSE
|
||||
SET code = concat(code, " CASE\n");
|
||||
END IF;
|
||||
|
||||
WHILE (i <= count_v)
|
||||
DO
|
||||
IF (simple)
|
||||
THEN
|
||||
SET code = concat(code, " WHEN ", i, " THEN SET str=\"", i, "\";\n");
|
||||
ELSE
|
||||
SET code = concat(code, " WHEN i=", i, " THEN SET str=\"", i, "\";\n");
|
||||
END IF;
|
||||
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
|
||||
SET code = concat(code, " ELSE SET str=\"unknown\";\n");
|
||||
SET code = concat(code, " END CASE;\n");
|
||||
SET code = concat(code, " SELECT str;\n");
|
||||
|
||||
SET code = concat(code, "END\n");
|
||||
|
||||
SET body = code;
|
||||
END|
|
||||
|
||||
|
||||
set @body="";
|
||||
call proc_19194_codegen("test_simple", 10, 1, @body);
|
||||
select @body;
|
||||
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| @body |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| CREATE PROCEDURE test_simple(i INT)
|
||||
BEGIN
|
||||
DECLARE str CHAR(10);
|
||||
CASE i
|
||||
WHEN 1 THEN SET str="1";
|
||||
WHEN 2 THEN SET str="2";
|
||||
WHEN 3 THEN SET str="3";
|
||||
WHEN 4 THEN SET str="4";
|
||||
WHEN 5 THEN SET str="5";
|
||||
WHEN 6 THEN SET str="6";
|
||||
WHEN 7 THEN SET str="7";
|
||||
WHEN 8 THEN SET str="8";
|
||||
WHEN 9 THEN SET str="9";
|
||||
WHEN 10 THEN SET str="10";
|
||||
ELSE SET str="unknown";
|
||||
END CASE;
|
||||
SELECT str;
|
||||
END
|
||||
|
|
||||
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
CREATE PROCEDURE test_simple(i INT)
|
||||
BEGIN
|
||||
DECLARE str CHAR(10);
|
||||
CASE i
|
||||
WHEN 1 THEN SET str="1";
|
||||
WHEN 2 THEN SET str="2";
|
||||
WHEN 3 THEN SET str="3";
|
||||
WHEN 4 THEN SET str="4";
|
||||
WHEN 5 THEN SET str="5";
|
||||
WHEN 6 THEN SET str="6";
|
||||
WHEN 7 THEN SET str="7";
|
||||
WHEN 8 THEN SET str="8";
|
||||
WHEN 9 THEN SET str="9";
|
||||
WHEN 10 THEN SET str="10";
|
||||
ELSE SET str="unknown";
|
||||
END CASE;
|
||||
SELECT str;
|
||||
END
|
||||
;
|
||||
call proc_19194_codegen("test_searched", 10, 0, @body);
|
||||
select @body;
|
||||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| @body |
|
||||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| CREATE PROCEDURE test_searched(i INT)
|
||||
BEGIN
|
||||
DECLARE str CHAR(10);
|
||||
CASE
|
||||
WHEN i=1 THEN SET str="1";
|
||||
WHEN i=2 THEN SET str="2";
|
||||
WHEN i=3 THEN SET str="3";
|
||||
WHEN i=4 THEN SET str="4";
|
||||
WHEN i=5 THEN SET str="5";
|
||||
WHEN i=6 THEN SET str="6";
|
||||
WHEN i=7 THEN SET str="7";
|
||||
WHEN i=8 THEN SET str="8";
|
||||
WHEN i=9 THEN SET str="9";
|
||||
WHEN i=10 THEN SET str="10";
|
||||
ELSE SET str="unknown";
|
||||
END CASE;
|
||||
SELECT str;
|
||||
END
|
||||
|
|
||||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
CREATE PROCEDURE test_searched(i INT)
|
||||
BEGIN
|
||||
DECLARE str CHAR(10);
|
||||
CASE
|
||||
WHEN i=1 THEN SET str="1";
|
||||
WHEN i=2 THEN SET str="2";
|
||||
WHEN i=3 THEN SET str="3";
|
||||
WHEN i=4 THEN SET str="4";
|
||||
WHEN i=5 THEN SET str="5";
|
||||
WHEN i=6 THEN SET str="6";
|
||||
WHEN i=7 THEN SET str="7";
|
||||
WHEN i=8 THEN SET str="8";
|
||||
WHEN i=9 THEN SET str="9";
|
||||
WHEN i=10 THEN SET str="10";
|
||||
ELSE SET str="unknown";
|
||||
END CASE;
|
||||
SELECT str;
|
||||
END
|
||||
;
|
||||
|
||||
CALL test_simple(1);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
CALL test_simple(2);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
CALL test_searched(1);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
CALL test_searched(2);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
|
||||
DROP PROCEDURE test_simple;
|
||||
DROP PROCEDURE test_searched;
|
||||
|
||||
set session ob_query_timeout = 500000000;
|
||||
|
||||
CALL bug_19194_simple(1);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
CALL bug_19194_simple(2);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
CALL bug_19194_simple(100);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 100 |
|
||||
+------+
|
||||
CALL bug_19194_simple(498);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 498 |
|
||||
+------+
|
||||
CALL bug_19194_simple(499);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 499 |
|
||||
+------+
|
||||
CALL bug_19194_simple(999);
|
||||
+---------+
|
||||
| str |
|
||||
+---------+
|
||||
| unknown |
|
||||
+---------+
|
||||
|
||||
CALL bug_19194_searched(1);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 1 |
|
||||
+------+
|
||||
CALL bug_19194_searched(2);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 2 |
|
||||
+------+
|
||||
CALL bug_19194_searched(100);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 100 |
|
||||
+------+
|
||||
CALL bug_19194_searched(498);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 498 |
|
||||
+------+
|
||||
CALL bug_19194_searched(499);
|
||||
+------+
|
||||
| str |
|
||||
+------+
|
||||
| 499 |
|
||||
+------+
|
||||
CALL bug_19194_searched(999);
|
||||
+---------+
|
||||
| str |
|
||||
+---------+
|
||||
| unknown |
|
||||
+---------+
|
||||
|
||||
DROP PROCEDURE bug_19194_simple;
|
||||
DROP PROCEDURE bug_19194_searched;
|
||||
|
||||
DROP PROCEDURE proc_19194_codegen;
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
result_format: 4
|
||||
drop function if exists bug23333;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE t1 (a int NOT NULL auto_increment primary key);
|
||||
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a));
|
||||
insert into t2 values (1,1);
|
||||
|
||||
create function bug23333()
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
declare x int;
|
||||
insert into t1 values (null);
|
||||
select count(*) from t1 into x;
|
||||
set @a = x;
|
||||
return @a;
|
||||
end|
|
||||
|
||||
## reset master;
|
||||
select bug23333();
|
||||
+------------+
|
||||
| bug23333() |
|
||||
+------------+
|
||||
| 1 |
|
||||
+------------+
|
||||
select count(*),@a from t1 /* must be 1,1 */;
|
||||
+----------+------+
|
||||
| count(*) | @a |
|
||||
+----------+------+
|
||||
| 1 | 1 |
|
||||
+----------+------+
|
||||
|
||||
drop table t1,t2;
|
||||
drop function if exists bug23333;
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user