Bug in diff_handlers and diff_cursors made it attempt to pop
the wrong number at jumps sometimes.
mysql-test/r/sp.result:
New testcase for BUG#5287.
mysql-test/t/sp.test:
New testcase for BUG#5287.
sql/sp_pcontext.cc:
Fixed diff_handlers and diff_cursors methods, they miscounted.
sql/sp_pcontext.h:
Made m_handlers available for diff_handlers.
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.
Mostly done, it works, but the temporary LABEL syntax still to be fixed.
mysql-test/r/sp-error.result:
New test case for WL#2002 (GOTO).
mysql-test/r/sp.result:
New test case for WL#2002 (GOTO).
(Also corrected another test)
mysql-test/t/sp-error.test:
New test case for WL#2002 (GOTO).
mysql-test/t/sp.test:
New test case for WL#2002 (GOTO).
(Also corrected another test)
sql/lex.h:
New symbol GOTO.
Also a temporary symbol LABEL, which hopefully will go away soon.
sql/sp_head.cc:
Fixed backpatching to cope with free GOTO labels an hpop and cpop instructions.
Also optimized away pointless jump instructions.
sql/sp_head.h:
Fixed backpatching to cope with free GOTO labels an hpop and cpop instructions.
We now sometimes generate hpop/cpop 0 instructions but the optimizer removes them.
sql/sp_pcontext.cc:
Added free GOTO labels, and support for coping with jumps out of blocks
with handlers or cursors.
sql/sp_pcontext.h:
Added free GOTO labels, and support for coping with jumps out of blocks
with handlers or cursors.
sql/sql_yacc.yy:
Added GOTO and LABEL, and adjusted backpatching accordingly. Also fixed LEAVE
out of blocks. The LABEL syntax will go away soon, hopefully.
Keep track on the default value and use it. (Or NULL, if not declared.)
mysql-test/r/sp.result:
New testcases for BUG#2776.
mysql-test/t/sp.test:
New testcases for BUG#2776.
sql/sp_pcontext.cc:
Initialize local variable default value.
sql/sp_pcontext.h:
New method for saving default value.
sql/sql_yacc.yy:
If DEFAULT is use as a value in SET variable = ... in an SP, actually use the default.
- Duplicate parameters/variables, conditions and cursors (not allowed).
- ITERATE in labelled BEGIN-END (not allowed).
- Missing SQLSTATE [VALUE] keywords in CONDITION/HANDLER declaration (added).
- Empty BEGIN-END (now allowed).
- End label (now optional).
include/mysqld_error.h:
New error code for duplicate things (vars et al) in SPs.
mysql-test/r/sp-error.result:
New error tests for ITERATE in begin-end block and duplicate variables,
conditions and cursors.
mysql-test/r/sp.result:
New tests for empty begin-end blocks, overriding local variables outside scope
only, leave a begin-end block, and SQLSTATE [VALUE] words for CONDITION/HANDLER
declarations.
mysql-test/t/sp-error.test:
New error tests for ITERATE in begin-end block and duplicate variables,
conditions and cursors.
mysql-test/t/sp.test:
New tests for empty begin-end blocks, overriding local variables outside scope
only, leave a begin-end block, and SQLSTATE [VALUE] words for CONDITION/HANDLER
declarations.
sql/lex.h:
New SQLSTATE keyword.
sql/share/czech/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/danish/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/dutch/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/english/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/estonian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/french/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/german/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/greek/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/hungarian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/italian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/japanese/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/korean/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/norwegian-ny/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/norwegian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/polish/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/portuguese/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/romanian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/russian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/serbian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/slovak/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/spanish/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/swedish/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/share/ukrainian/errmsg.txt:
New error message for duplicate things (vars et al) in SPs.
sql/sp_pcontext.cc:
Keep track on scope limits for error checking of duplicate variables,
conditions and cursors.
sql/sp_pcontext.h:
Keep track on scope limits for error checking of duplicate variables,
conditions and cursors.
Also need to flag BEGIN labels to check for illegal ITERATEs.
sql/sql_yacc.yy:
End-labels in SPs loop and begin-end blocks are now optional.
SQLSTATE [VALUE] added to syntax for sqlstates.
Check for duplicate variable, condition and cursor declarations, but
only in the same scope.
Empty BEGIN-END statements now allowed.
Check if ITERATE is referring to a BEGIN label.
(updated) Protocol_cursor class.
Also did some bug fixes.
Docs/sp-imp-spec.txt:
Added CURSOR docs (and fixed typos)
Docs/sp-implemented.txt:
Updated for CURSORs
include/mysqld_error.h:
New error codes/messages for CURSORs
libmysqld/Makefile.am:
SP cursors now needs this.
mysql-test/r/sp-error.result:
New tests for cursors.
mysql-test/r/sp.result:
New tests for cursors.
mysql-test/t/sp-error.test:
New tests for cursors.
mysql-test/t/sp.test:
New tests for cursors.
sql/protocol.cc:
We now always have Protocol_cursor (SPs use it)
sql/protocol.h:
Fixed bugs in Protocol_cursor (for SPs)
sql/protocol_cursor.cc:
Fixed bugs in Protocol_cursor (for SPs)
sql/share/czech/errmsg.txt:
New error codes/messages for CURSORs
sql/share/danish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/dutch/errmsg.txt:
New error codes/messages for CURSORs
sql/share/english/errmsg.txt:
New error codes/messages for CURSORs
sql/share/estonian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/french/errmsg.txt:
New error codes/messages for CURSORs
sql/share/german/errmsg.txt:
New error codes/messages for CURSORs
sql/share/greek/errmsg.txt:
New error codes/messages for CURSORs
sql/share/hungarian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/italian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/japanese/errmsg.txt:
New error codes/messages for CURSORs
sql/share/korean/errmsg.txt:
New error codes/messages for CURSORs
sql/share/norwegian-ny/errmsg.txt:
New error codes/messages for CURSORs
sql/share/norwegian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/polish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/portuguese/errmsg.txt:
New error codes/messages for CURSORs
sql/share/romanian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/russian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/serbian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/slovak/errmsg.txt:
New error codes/messages for CURSORs
sql/share/spanish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/swedish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/ukrainian/errmsg.txt:
New error codes/messages for CURSORs
sql/sp_head.cc:
Added cursor support.
Also fixed problems with item_lists, where pointers and ref_pointer_arrays.
sql/sp_head.h:
Added cursor support
sql/sp_pcontext.cc:
Added cursor support
sql/sp_pcontext.h:
Added cursor support
sql/sp_rcontext.cc:
Added cursor support, in particular the new sp_cursor class.
sql/sp_rcontext.h:
Added cursor support, in particular the new sp_cursor class.
sql/sql_lex.h:
We sometimes need to copy item_lists in LEX when executing substatements in SPs
sql/sql_yacc.yy:
Added minimal cursor support (not the full syntax yet).
MySQL error codes as well.
(No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.)
WL#850
Docs/sp-imp-spec.txt:
Spec of CONDITIONs and HANDLERs (and updated some old stuff too).
Docs/sp-implemented.txt:
Updated info about caching, CONDITIONs and HANDLERs.
include/mysqld_error.h:
New error for undeclared CONDITION.
libmysqld/Makefile.am:
New file: sp_rcontext.cc.
mysql-test/r/sp-error.result:
New tests for CONDITIONs and HANDLERs.
mysql-test/r/sp.result:
New tests for CONDITIONs and HANDLERs.
mysql-test/t/sp-error.test:
New tests for CONDITIONs and HANDLERs.
mysql-test/t/sp.test:
New tests for CONDITIONs and HANDLERs.
sql/Makefile.am:
New file: sp_rcontext.cc.
sql/lex.h:
New symbols for CONDITIONs, HANDLERs and CURSORs.
sql/mysqld.cc:
Catch error if we have a handler for it.
sql/protocol.cc:
Catch error if we have a handler for it.
sql/share/czech/errmsg.txt:
New error for undeclared CONDITION.
sql/share/danish/errmsg.txt:
New error for undeclared CONDITION.
sql/share/dutch/errmsg.txt:
New error for undeclared CONDITION.
sql/share/english/errmsg.txt:
New error for undeclared CONDITION.
sql/share/estonian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/french/errmsg.txt:
New error for undeclared CONDITION.
sql/share/german/errmsg.txt:
New error for undeclared CONDITION.
sql/share/greek/errmsg.txt:
New error for undeclared CONDITION.
sql/share/hungarian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/italian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/japanese/errmsg.txt:
New error for undeclared CONDITION.
sql/share/korean/errmsg.txt:
New error for undeclared CONDITION.
sql/share/norwegian-ny/errmsg.txt:
New error for undeclared CONDITION.
sql/share/norwegian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/polish/errmsg.txt:
New error for undeclared CONDITION.
sql/share/portuguese/errmsg.txt:
New error for undeclared CONDITION.
sql/share/romanian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/russian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/serbian/errmsg.txt:
New error for undeclared CONDITION.
sql/share/slovak/errmsg.txt:
New error for undeclared CONDITION.
sql/share/spanish/errmsg.txt:
New error for undeclared CONDITION.
sql/share/swedish/errmsg.txt:
New error for undeclared CONDITION.
sql/share/ukrainian/errmsg.txt:
New error for undeclared CONDITION.
sql/sp_head.cc:
New HANDLER code.
sql/sp_head.h:
New HANDLER code.
sql/sp_pcontext.cc:
New CONDITION and HANDLER code.
sql/sp_pcontext.h:
New CONDITION and HANDLER code.
sql/sp_rcontext.h:
New CONDITION and HANDLER code.
sql/sql_yacc.yy:
New CONDITION and HANDLER code.
Changed another unecessary use of Item_string into LEX_STRING (in sp_pcontext).
Docs/sp-implemented.txt:
Added IF EXISTS to DROP PROCEDURE|FUNCTION
mysql-test/r/sp-error.result:
Added IF EXISTS to DROP PROCEDURE|FUNCTION
mysql-test/t/sp-error.test:
Added IF EXISTS to DROP PROCEDURE|FUNCTION
sql/sp_pcontext.cc:
Changed another unecessary use of Item_string into LEX_STRING.
sql/sp_pcontext.h:
Changed another unecessary use of Item_string into LEX_STRING.
sql/sql_parse.cc:
Added IF EXISTS to DROP PROCEDURE|FUNCTION
sql/sql_yacc.yy:
Added IF EXISTS to DROP PROCEDURE|FUNCTION
sql/sp_head.cc:
Init. the simple_case flag.
sql/sp_head.h:
New flag for (simple)case parsing.
sql/sp_pcontext.cc:
Removed push_gen_label method (not needed any more).
sql/sp_pcontext.h:
Removed push_gen_label method (not needed any more).
Fixed bug in pop().
sql/sql_yacc.yy:
Added CASE parsing.
Implemented IF-THEN-ELSE.
sql/sp_head.cc:
Reimplemented the broken backpatching, so it works for nested constructions and
IF-THEN-ELSE too.
sql/sp_head.h:
Reimplemented the broken backpatching, so it works for nested constructions and
IF-THEN-ELSE too.
sql/sp_pcontext.cc:
Return the value from push-methods, for convenience.
sql/sp_pcontext.h:
Return the value from push-methods, for convenience.
sql/sql_yacc.yy:
Implemented IF-THEN-ELSE.
Corrected for the new backpatch method.
Fixed backpatching of forward jumps.
Implemented LOOP, WHILE, REPEAT (temporarily known as SPREPEAT).
Known bug: Expression evaluation still not quite ok (e.g. "x > 0"),
which is why IF and CASE is not yet implemented.
sql/Makefile.am:
Added new sp.h/sp.cc file.
sql/item.h:
New deferred result_type() method in Item_splocal.
sql/lex.h:
Temporary fix until REPEAT conflict is solved. Use SPREPEAT for now.
sql/sp_head.cc:
Moved create/find/drop functions to sp.cc.
Fixed the backpatch stuff.
(Also removed some dead code and updated comments.)
sql/sp_head.h:
Moved create/find/drop declarations to sp.h.
Fixed the backpatch stuff.
sql/sp_pcontext.h:
New method: last_label().
sql/sql_parse.cc:
Include sp.h.
sql/sql_yacc.yy:
Fixed backpatching of forward jumps.
Implemented LOOP, WHILE, and REPEAT. (Note: SPREPEAT for now.)
for better jump support. Some flow control support added too (but not
complete).
sql/lex.h:
Added more keywords for embedded SQL.
sql/sp_head.cc:
Fixed bugs in the parameter evaluation.
Modified execute() for better jump support.
Added jump instruction and backpatch support.
sql/sp_head.h:
Fixed bugs in the parameter evaluation.
Modified execute() for better jump support.
Added jump instruction and backpatch support.
sql/sp_pcontext.cc:
Added label support.
sql/sp_pcontext.h:
Added label support.
sql/sql_yacc.yy:
Outlined flow control constructs (parses, but nothing generated yet).
Implements creation and dropping of PROCEDUREs, IN, OUT, and INOUT parameters,
single-statement procedures, rudimentary multi-statement (begin-end) prodedures
(when the client can handle it), and local variables.
Missing most of the embedded SQL language, all attributes, FUNCTIONs, error handling,
reparses procedures at each call (no caching), etc, etc.
Certainly buggy too, but procedures can actually be created and called....
sql/Makefile.am:
Added SP files.
sql/item.cc:
Added this*_item() methods for Item_splocal. (SP local variable)
sql/item.h:
Added this*_item() methods for SPs in Item, and the new Item_splocal
class (SP local variable).
sql/lex.h:
Added new symbols for SPs. (Note: SPSET is temporary and will go away later.)
sql/sql_class.cc:
Initialize SP runtime context in THD.
sql/sql_class.h:
Add SP runtime context to THD.
sql/sql_lex.cc:
Init. buf pointer to beginning of command (needed by SPs).
Also initialize SP head and parse time context.
sql/sql_lex.h:
New SQLCOM_ tags for SPs, and added pointer to beginning of command pointer and
SP head and parse-time context to LEX.
sql/sql_parse.cc:
Added SQLCOM_CREATE_PROCEDURE, _CALL, _ALTER_PROCEDURE and _DROP_PROCEDURE cases.
(Still rudimentary and lacking proper error handling...)
sql/sql_yacc.yy:
Lots and lots of additions for SPs...
(Still even more missing, and no error messages...)