mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Major rehacking and cleanup of sp_pcontext.
This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
This commit is contained in:
@ -68,6 +68,42 @@ goto foo;
|
||||
end|
|
||||
ERROR 42000: GOTO with no matching label: foo
|
||||
create procedure foo()
|
||||
begin
|
||||
begin
|
||||
label foo;
|
||||
end;
|
||||
goto foo;
|
||||
end|
|
||||
ERROR 42000: GOTO with no matching label: foo
|
||||
create procedure foo()
|
||||
begin
|
||||
goto foo;
|
||||
begin
|
||||
label foo;
|
||||
end;
|
||||
end|
|
||||
ERROR 42000: GOTO with no matching label: foo
|
||||
create procedure foo()
|
||||
begin
|
||||
begin
|
||||
goto foo;
|
||||
end;
|
||||
begin
|
||||
label foo;
|
||||
end;
|
||||
end|
|
||||
ERROR 42000: GOTO with no matching label: foo
|
||||
create procedure foo()
|
||||
begin
|
||||
begin
|
||||
label foo;
|
||||
end;
|
||||
begin
|
||||
goto foo;
|
||||
end;
|
||||
end|
|
||||
ERROR 42000: GOTO with no matching label: foo
|
||||
create procedure foo()
|
||||
foo: loop
|
||||
foo: loop
|
||||
set @x=2;
|
||||
@ -288,6 +324,16 @@ 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 p()
|
||||
begin
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
goto L1;
|
||||
end;
|
||||
select field from t1;
|
||||
label L1;
|
||||
end|
|
||||
ERROR HY000: GOTO is not allowed in a stored procedure handler
|
||||
create procedure bug1965()
|
||||
begin
|
||||
declare c cursor for select val from t1 order by valname;
|
||||
|
Reference in New Issue
Block a user