summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2005-11-01 14:58:52 +0100
committerunknown <pem@mysql.com>2005-11-01 14:58:52 +0100
commit2c4c542ba2a82d42d3109f5257d0323e99bb321d (patch)
treed8e18d83d387b0b8b5cfd092973e6441f0ccec8a /sql/sql_yacc.yy
parent389018280db5fab79ec76fb286071734b014fc0e (diff)
downloadmariadb-git-2c4c542ba2a82d42d3109f5257d0323e99bb321d.tar.gz
Fixed BUG#14376: MySQL crash on scoped variable (re)initialization
Added finer scope control for default clauses of local variable declarations. mysql-test/r/sp.result: New test case for BUG#14376. mysql-test/t/sp.test: New test case for BUG#14376. sql/sp_pcontext.cc: Added boundary variable for local parameters/variables, for better scope control of default values. sql/sp_pcontext.h: Added boundary variable for local parameters/variables, for better scope control of default values. sql/sql_yacc.yy: Make the variables of the current DECLARE "invisible" to its DEFAULT clause.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 109dcd7e86a..c3c53b2f611 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1660,7 +1660,12 @@ sp_decls:
sp_decl:
DECLARE_SYM sp_decl_idents type
- { Lex->sphead->reset_lex(YYTHD); }
+ {
+ LEX *lex= Lex;
+
+ lex->sphead->reset_lex(YYTHD);
+ lex->spcont->declare_var_boundary($2);
+ }
sp_opt_default
{
LEX *lex= Lex;
@@ -1690,6 +1695,7 @@ sp_decl:
lex->sphead->add_instr(in);
ctx->set_default(i, it);
}
+ ctx->declare_var_boundary(0);
lex->sphead->restore_lex(YYTHD);
$$.vars= $2;
$$.conds= $$.hndlrs= $$.curs= 0;