mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +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;
|
||||
|
Reference in New Issue
Block a user