Commit 278f7fdd authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: get rid of (Item_splocal*)item downcast

parent 932100c8
...@@ -570,6 +570,7 @@ class COND_EQUAL; ...@@ -570,6 +570,7 @@ class COND_EQUAL;
class st_select_lex_unit; class st_select_lex_unit;
class Item_func_not; class Item_func_not;
class Item_splocal;
class Item { class Item {
Item(const Item &); /* Prevent use of these */ Item(const Item &); /* Prevent use of these */
...@@ -1431,7 +1432,7 @@ public: ...@@ -1431,7 +1432,7 @@ public:
delete this; delete this;
} }
virtual bool is_splocal() { return 0; } /* Needed for error checking */ virtual Item_splocal *get_item_splocal() { return 0; }
/* /*
Return Settable_routine_parameter interface of the Item. Return 0 Return Settable_routine_parameter interface of the Item. Return 0
...@@ -1729,8 +1730,6 @@ public: ...@@ -1729,8 +1730,6 @@ public:
enum_field_types sp_var_type, enum_field_types sp_var_type,
uint pos_in_q= 0, uint len_in_q= 0); uint pos_in_q= 0, uint len_in_q= 0);
bool is_splocal() { return 1; } /* Needed for error checking */
Item *this_item(); Item *this_item();
const Item *this_item() const; const Item *this_item() const;
Item **this_item_addr(THD *thd, Item **); Item **this_item_addr(THD *thd, Item **);
...@@ -1750,6 +1749,8 @@ private: ...@@ -1750,6 +1749,8 @@ private:
bool set_value(THD *thd, sp_rcontext *ctx, Item **it); bool set_value(THD *thd, sp_rcontext *ctx, Item **it);
public: public:
Item_splocal *get_item_splocal() { return this; }
Settable_routine_parameter *get_settable_routine_parameter() Settable_routine_parameter *get_settable_routine_parameter()
{ {
return this; return this;
......
...@@ -985,9 +985,9 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) ...@@ -985,9 +985,9 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
/* Find all instances of Item_splocal used in this statement */ /* Find all instances of Item_splocal used in this statement */
for (Item *item= instr->free_list; item; item= item->next) for (Item *item= instr->free_list; item; item= item->next)
{ {
if (item->is_splocal()) Item_splocal *item_spl= item->get_item_splocal();
if (item_spl)
{ {
Item_splocal *item_spl= (Item_splocal*)item;
if (item_spl->pos_in_query) if (item_spl->pos_in_query)
sp_vars_uses.append(item_spl); sp_vars_uses.append(item_spl);
} }
......
...@@ -3189,7 +3189,7 @@ mysql_execute_command(THD *thd) ...@@ -3189,7 +3189,7 @@ mysql_execute_command(THD *thd)
/* Count SP local vars in the top-level SELECT list */ /* Count SP local vars in the top-level SELECT list */
while ((item= it++)) while ((item= it++))
{ {
if (item->is_splocal()) if (item->get_item_splocal())
splocal_refs++; splocal_refs++;
} }
/* /*
......
...@@ -9230,9 +9230,9 @@ simple_expr: ...@@ -9230,9 +9230,9 @@ simple_expr:
} }
| DEFAULT '(' simple_ident ')' | DEFAULT '(' simple_ident ')'
{ {
if ($3->is_splocal()) Item_splocal *il= $3->get_item_splocal();
if (il)
{ {
Item_splocal *il= static_cast<Item_splocal *>($3);
my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str); my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
MYSQL_YYABORT; MYSQL_YYABORT;
......
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