summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-09-10 11:11:52 +0200
committerunknown <pem@mysql.comhem.se>2004-09-10 11:11:52 +0200
commit1912148cec19f4a20eddae9d0143124909872173 (patch)
tree177a307bee403859b893521b666bfd245cbef01f /sql/sql_yacc.yy
parent862e78568e43272002dea1a12ff62e3d097be558 (diff)
downloadmariadb-git-1912148cec19f4a20eddae9d0143124909872173.tar.gz
Fixed BUG#3294: Stored procedure crash if table dropped before use.
Dropping the table was not the real problem, the problem was with errors occuring within error handlers. mysql-test/r/sp-error.result: New test case for BUG#3294. mysql-test/t/sp-error.test: New test case for BUG#3294. sql/sp_head.cc: Use hreturn instruction both for continue and exit handlers (a special case of a jump). sql/sp_head.h: Use hreturn instruction both for continue and exit handlers (a special case of a jump). sql/sp_rcontext.cc: Keep track on if we're in a handler already, for error handling. sql/sp_rcontext.h: Keep track on if we're in a handler already, for error handling. sql/sql_yacc.yy: Use hreturn instruction both for continue and exit handlers (a special case of a jump).
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 8a5526a6b9f..8d1a668e98d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1599,13 +1599,17 @@ sp_decl:
sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont;
sp_label_t *hlab= lex->spcont->pop_label(); /* After this hdlr */
+ sp_instr_hreturn *i;
if ($2 == SP_HANDLER_CONTINUE)
- sp->add_instr(new sp_instr_hreturn(sp->instructions(), ctx,
- ctx->current_pvars()));
+ {
+ i= new sp_instr_hreturn(sp->instructions(), ctx,
+ ctx->current_pvars());
+ sp->add_instr(i);
+ }
else
{ /* EXIT or UNDO handler, just jump to the end of the block */
- sp_instr_jump *i= new sp_instr_jump(sp->instructions(), ctx);
+ i= new sp_instr_hreturn(sp->instructions(), ctx, 0);
sp->add_instr(i);
sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */