mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Enforce standard declaration order in SPs.
Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
This commit is contained in:
@ -194,8 +194,8 @@ create table t1 (val int, x float)|
|
||||
insert into t1 values (42, 3.1), (19, 1.2)|
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare c cursor for select * from t1;
|
||||
open c;
|
||||
fetch c into x, y;
|
||||
close c;
|
||||
@ -203,8 +203,8 @@ end|
|
||||
ERROR 42000: Undeclared variable: y
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare c cursor for select * from t1;
|
||||
open c;
|
||||
fetch c into x;
|
||||
close c;
|
||||
@ -214,10 +214,10 @@ ERROR HY000: Wrong number of FETCH variables
|
||||
drop procedure p|
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare y float;
|
||||
declare z int;
|
||||
declare c cursor for select * from t1;
|
||||
open c;
|
||||
fetch c into x, y, z;
|
||||
close c;
|
||||
@ -252,9 +252,28 @@ declare c cursor for select field from t1;
|
||||
end|
|
||||
ERROR 42000: Duplicate cursor: c
|
||||
create procedure u()
|
||||
use sptmp;
|
||||
#|
|
||||
use sptmp|
|
||||
ERROR 42000: USE is not allowed in a stored procedure
|
||||
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 procedure bug1965()
|
||||
begin
|
||||
declare c cursor for select val from t1 order by valname;
|
||||
|
@ -660,12 +660,12 @@ drop table t3|
|
||||
drop procedure hndlr4|
|
||||
create procedure cur1()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c cursor for select * from test.t2;
|
||||
declare a char(16);
|
||||
declare b int;
|
||||
declare c double;
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from test.t2;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a, b, c;
|
||||
@ -688,9 +688,9 @@ create table t3 ( s char(16), i int )|
|
||||
create procedure cur2()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c1 cursor for select id,data from test.t1;
|
||||
declare c2 cursor for select i from test.t2;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c1;
|
||||
open c2;
|
||||
repeat
|
||||
@ -764,8 +764,8 @@ create procedure modes(out c1 int, out c2 int)
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c cursor for select data from t1;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
select 1 || 2 into c1;
|
||||
set c2 = 0;
|
||||
open c;
|
||||
@ -915,8 +915,8 @@ drop procedure bug1874|
|
||||
create procedure bug2260()
|
||||
begin
|
||||
declare v1 int;
|
||||
declare continue handler for not found set @x2 = 1;
|
||||
declare c1 cursor for select data from t1;
|
||||
declare continue handler for not found set @x2 = 1;
|
||||
open c1;
|
||||
fetch c1 into v1;
|
||||
set @x2 = 2;
|
||||
@ -996,10 +996,13 @@ drop table t3|
|
||||
drop procedure bug2614|
|
||||
create function bug2674 () returns int
|
||||
return @@sort_buffer_size|
|
||||
set @osbs = @@sort_buffer_size|
|
||||
set @@sort_buffer_size = 262000|
|
||||
select bug2674()|
|
||||
bug2674()
|
||||
262136
|
||||
262000
|
||||
drop function bug2674|
|
||||
set @@sort_buffer_size = @osbs|
|
||||
create procedure bug3259_1 () begin end|
|
||||
create procedure BUG3259_2 () begin end|
|
||||
create procedure Bug3259_3 () begin end|
|
||||
|
@ -264,8 +264,8 @@ insert into t1 values (42, 3.1), (19, 1.2)|
|
||||
--error 1314
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare c cursor for select * from t1;
|
||||
|
||||
open c;
|
||||
fetch c into x, y;
|
||||
@ -274,8 +274,8 @@ end|
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare c cursor for select * from t1;
|
||||
|
||||
open c;
|
||||
fetch c into x;
|
||||
@ -287,10 +287,10 @@ drop procedure p|
|
||||
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
declare y float;
|
||||
declare z int;
|
||||
declare c cursor for select * from t1;
|
||||
|
||||
open c;
|
||||
fetch c into x, y, z;
|
||||
@ -333,8 +333,30 @@ end|
|
||||
# USE is not allowed
|
||||
--error 1323
|
||||
create procedure u()
|
||||
use sptmp;
|
||||
use sptmp|
|
||||
|
||||
# Enforced standard order of declarations
|
||||
--error 1324
|
||||
create procedure p()
|
||||
begin
|
||||
declare c cursor for select * from t1;
|
||||
declare x int;
|
||||
end|
|
||||
--error 1324
|
||||
create procedure p()
|
||||
begin
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '42S99' set x = 1;
|
||||
declare foo condition for sqlstate '42S99';
|
||||
end|
|
||||
|
||||
--error 1325
|
||||
create procedure p()
|
||||
begin
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '42S99' set x = 1;
|
||||
declare c cursor for select * from t1;
|
||||
end|
|
||||
|
||||
#
|
||||
# BUG#1965
|
||||
|
@ -776,12 +776,12 @@ drop procedure hndlr4|
|
||||
#
|
||||
create procedure cur1()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c cursor for select * from test.t2;
|
||||
declare a char(16);
|
||||
declare b int;
|
||||
declare c double;
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from test.t2;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
|
||||
open c;
|
||||
repeat
|
||||
@ -806,9 +806,9 @@ create table t3 ( s char(16), i int )|
|
||||
create procedure cur2()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c1 cursor for select id,data from test.t1;
|
||||
declare c2 cursor for select i from test.t2;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
|
||||
open c1;
|
||||
open c2;
|
||||
@ -879,8 +879,8 @@ create procedure modes(out c1 int, out c2 int)
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare x int;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
declare c cursor for select data from t1;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
|
||||
select 1 || 2 into c1;
|
||||
set c2 = 0;
|
||||
@ -1069,8 +1069,8 @@ drop procedure bug1874|
|
||||
create procedure bug2260()
|
||||
begin
|
||||
declare v1 int;
|
||||
declare continue handler for not found set @x2 = 1;
|
||||
declare c1 cursor for select data from t1;
|
||||
declare continue handler for not found set @x2 = 1;
|
||||
|
||||
open c1;
|
||||
fetch c1 into v1;
|
||||
@ -1156,8 +1156,11 @@ drop procedure bug2614|
|
||||
create function bug2674 () returns int
|
||||
return @@sort_buffer_size|
|
||||
|
||||
set @osbs = @@sort_buffer_size|
|
||||
set @@sort_buffer_size = 262000|
|
||||
select bug2674()|
|
||||
drop function bug2674|
|
||||
set @@sort_buffer_size = @osbs|
|
||||
|
||||
#
|
||||
# BUG#3259
|
||||
|
Reference in New Issue
Block a user