• unknown's avatar
    A fix and a test case for "Bug #12168 'DECLARE CONTINUE HANDLER FOR · cf6736c8
    unknown authored
    NOT FOUND ...' in conditional handled incorrectly".
    
    Whenever we remove an instruction during optimization, we need to
    adjust instruction numbers (ip - instruction pointer) stored in all
    instructions. In addition to that, sp_instr_hpush_jump, which 
    corresponds to DECLARE CONTINUE HANDLER needs adjustment for m_handler,
    which holds the number of instruction with the continue handler.
    In the bug report, a wrong ip stored in m_handler was pointing at 
    FETCH, which resulted in an error message and abnormal SP termination.
    The fix is to just remove m_handler member from sp_instr_hpush_jump,
    as it's always points to the instruction next to the DECLARE
    statement itself (m_ip+1).
    
    
    mysql-test/r/sp.result:
      Test results fixed (Bug#12168)
    mysql-test/t/sp.test:
      A test case for Bug#12168 "'DECLARE CONTINUE HANDLER FOR NOT
      FOUND ...' in conditional handled incorrectly"
    sql/sp_head.cc:
      Remove m_handler (the number of continue handler instruction)
      as it always equal to m_ip+1
    sql/sp_head.h:
      Remove m_handler (the number of continue handler instruction)
      as it always equal to m_ip+1
    cf6736c8
sp_head.cc 63.1 KB