Commit 48ea6e3b authored by unknown's avatar unknown

fixed SP variables detecting (BUG#4604)

fixed error handling


mysql-test/r/view.result:
  SP variables inside view test
mysql-test/t/view.test:
  SP variables inside view test
sql/sql_base.cc:
  fixed error messages handling
sql/sql_yacc.yy:
  fixed SP variables detecting
parent d3558dc3
......@@ -977,3 +977,9 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
drop view v1;
create view v1 (a,a) as select 'a','a';
ERROR 42S21: Duplicate column name 'a'
create procedure p11 () begin declare v int; create view v1 as select v; end;//
Warnings:
Warning 1310 Referring to uninitialized variable v
call p11();
ERROR HY000: View's SELECT contains a variable or parameter
drop procedure p11;
......@@ -900,3 +900,13 @@ drop view v1;
#
-- error 1060
create view v1 (a,a) as select 'a','a';
#
# SP variables inside view test
#
delimiter //;
create procedure p11 () begin declare v int; create view v1 as select v; end;//
delimiter ;//
-- error 1350
call p11();
drop procedure p11;
......@@ -1760,7 +1760,7 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
DBUG_ENTER("open_and_lock_tables");
uint counter;
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
DBUG_RETURN(mysql_handle_derived(thd->lex));
}
......
......@@ -1987,7 +1987,8 @@ sp_elseifs:
sp_case:
expr THEN_SYM
{
sp_head *sp= Lex->sphead;
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *ctx= Lex->spcont;
uint ip= sp->instructions();
sp_instr_jump_if_not *i;
......@@ -2005,6 +2006,7 @@ sp_case:
Item *expr= new Item_func_eq(var, $1);
i= new sp_instr_jump_if_not(ip, expr);
lex->variables_used= 1;
}
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
sp->add_instr(i);
......@@ -6170,6 +6172,7 @@ simple_ident:
$1.str);
}
$$ = (Item*) new Item_splocal($1, spv->offset);
lex->variables_used= 1;
}
else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment