mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Optimization for MDEV-10411 Providing compatibility for basic PL/SQL constructs
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.
This commit is contained in:
@@ -5428,8 +5428,20 @@ LEX::sp_block_with_exceptions_finalize_executable_section(THD *thd,
|
||||
|
||||
bool
|
||||
LEX::sp_block_with_exceptions_finalize_exceptions(THD *thd,
|
||||
uint executable_section_ip)
|
||||
uint executable_section_ip,
|
||||
uint exception_count)
|
||||
{
|
||||
if (!exception_count)
|
||||
{
|
||||
/*
|
||||
The jump from the end of DECLARE section to
|
||||
the beginning of the EXCEPTION section that we added in
|
||||
sp_block_with_exceptions_finalize_declarations() is useless
|
||||
if there were no exceptions.
|
||||
Replace it to "no operation".
|
||||
*/
|
||||
return sphead->replace_instr_to_nop(thd, executable_section_ip - 1);
|
||||
}
|
||||
/*
|
||||
Generate a jump from the end of the EXCEPTION code
|
||||
to the executable section.
|
||||
|
Reference in New Issue
Block a user