From d2b007d6bc8458d3451bb28cc7319e39dae00e7d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 15 Aug 2016 21:46:22 +0400 Subject: 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. --- mysql-test/suite/compat/oracle/r/sp-code.result | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/compat/oracle/r/sp-code.result b/mysql-test/suite/compat/oracle/r/sp-code.result index 751549b7500..42e0fb41aaa 100644 --- a/mysql-test/suite/compat/oracle/r/sp-code.result +++ b/mysql-test/suite/compat/oracle/r/sp-code.result @@ -21,7 +21,7 @@ END; / SHOW PROCEDURE CODE p1; Pos Instruction -0 jump 3 +0 jump 2 CALL p1; DROP PROCEDURE p1; # No HANDLER declarations, no code, some exceptions @@ -133,10 +133,9 @@ SHOW PROCEDURE CODE p1; Pos Instruction 0 hpush_jump 3 1 EXIT 1 set v@0 123 -2 hreturn 0 5 +2 hreturn 0 4 3 set v@0 223 -4 jump 5 -5 hpop 1 +4 hpop 1 set @v= 10; CALL p1(@v); SELECT @v; -- cgit v1.2.1