Part 2:
Moving the part of Sql_condition that contain condition items
(such as m_class_origin, m_cursor_name, etc) into a separate
class Sql_condition_items. This allows to remove duplicate code in
different Sql_condition constructors.
Also, introducing new Sql_condition constructors and removing the method
Sql_condition::set(). All code sequences that called an Sql_condition
constructor followed by Sql_condition::set() are now replaced to
the new constructor calls. This gives light performance improvement,
as the relevant members are now initialized only one time.
An additional change for "Part 9: EXCEPTION handlers"
This construct:
EXCEPTION WHEN OTHERS THEN ...;
now catches warning-alike conditions, e.g. NO_DATA_FOUND.
The crash happened because of a wrong reset_lex() .. restore_lex() sequence.
The Item in WHERE clause and the corresponding sp_instr_jump_if_not() were
erroneously created using different LEX.
This is a fix for "MDEV-10580 sql_mode=ORACLE: FOR loop statement"
The tokenizer now treats digits followed by two dots (e.g. '1..')
as an integer number '1' followed by DOT_DOT_SYM.
Previously this sequence was treated as a double number '1.' followed by '.'.
as this type of SHOW is only available in debug builds.
A bug in b7af3e704dd7800638ef677e9d921ad3e467a9a6.
All SHOW FUNCTION CODE queries should be in compat/oracle.sp-code.
Fixed that the ITERATE statement inside a FOR LOOP statement did not
increment the index variable before jumping to the beginning
of the loop, which caused the loop to repeat endlessly.
Adding methods:
- LEX::sp_while_loop_expression()
- LEX::sp_while_loop_finalize()
to reuse code between sql_yacc.yy and sql_yacc_ora.yy.
FOR loop will also reuse these methods.
Part 5: EXIT statement
Adding unconditional EXIT statement:
EXIT [ label ]
Conditional EXIT statements with WHERE clause
will be added in a separate patch.
Moving similar code from sql_yacc.yy and sql_yacc_ora.yy to methods:
LEX::maybe_start_compound_statement()
LEX::sp_push_loop_label()
LEX::sp_push_loop_empty_label()
LEX::sp_pop_loop_label()
LEX::sp_pop_loop_empty_label()
The EXIT statement will also reuse this code.
Moving the code from *.yy to methods:
LEX::sp_change_context()
LEX::sp_leave_statement()
LEX::sp_iterate_statement()
to reuse the same code between LEAVE and ITERATE statements.
EXIT statement will also reuse the same code.
When processing an SP body:
CREATE PROCEDURE p1 (parameters)
AS [ declarations ]
BEGIN statements
[ EXCEPTION exceptions ]
END;
the parser generates two "jump" instructions:
- from the end of "declarations" to the beginning of EXCEPTION
- from the end of EXCEPTION to "statements"
These jumps are useless if EXCEPTION does not exist.
This patch makes sure that these two "jump" instructions are
generated only if EXCEPTION really exists.
- Part 9: EXCEPTION handlers
The top-most stored routine blocks now support EXCEPTION clause
in its correct place:
AS [ declarations ]
BEGIN statements
[ EXCEPTION exceptions ]
END
Inner block will be done in a separate commit.
- Part 14: IN OUT instead of INOUT (in SP parameter declarations)
Part 13: RETURN vs RETURNS in function definition:
CREATE FUNCTION f1(a INT) RETURN INT ...
Part 12: No parentheses if no arguments:
CREATE FUNCTION f1 RETURN INT ...
Part 12: No parentheses if no arguments
Now "CREATE PROCEDURE p1 AS" is supported with no parentheses after the name.
Note, "CREATE FUNCTION f1 AS" is not supported yet, due to grammar conflict
with UDFs. Functions will be done in a separate patch.
Part 9: EXCEPTION handlers
- Adding exception handler syntax:
WHEN exception_name THEN statement
- Adding EXCEPTION section intoi the top BEGIN..END SP block.
Note, currently EXCEPTION goes in the beginning of the top BEGIN..END
SP block.
TODO:
- add EXCEPTION section into inner blocks
- move EXCEPTION to the end of the block