mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
cleanup: class my_var
* split my_var class in three - base my_var and two descencants, move properties into descendants, remove if(), create a virtual method instead * factor out the common code in the select_var_ident parser rule
This commit is contained in:
@ -3731,6 +3731,18 @@ Statement_map::~Statement_map()
|
||||
my_hash_free(&st_hash);
|
||||
}
|
||||
|
||||
bool my_var_user::set(THD *thd, Item *item)
|
||||
{
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(name, item);
|
||||
suv->save_item_result(item);
|
||||
return suv->fix_fields(thd, 0) || suv->update();
|
||||
}
|
||||
|
||||
bool my_var_sp::set(THD *thd, Item *item)
|
||||
{
|
||||
return thd->spcont->set_variable(thd, offset, &item);
|
||||
}
|
||||
|
||||
int select_dumpvar::send_data(List<Item> &items)
|
||||
{
|
||||
List_iterator_fast<my_var> var_li(var_list);
|
||||
@ -3751,20 +3763,8 @@ int select_dumpvar::send_data(List<Item> &items)
|
||||
}
|
||||
while ((mv= var_li++) && (item= it++))
|
||||
{
|
||||
if (mv->local)
|
||||
{
|
||||
if (thd->spcont->set_variable(thd, mv->offset, &item))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
|
||||
suv->save_item_result(item);
|
||||
if (suv->fix_fields(thd, 0))
|
||||
DBUG_RETURN (1);
|
||||
if (suv->update())
|
||||
DBUG_RETURN (1);
|
||||
}
|
||||
if (mv->set(thd, item))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(thd->is_error());
|
||||
}
|
||||
|
Reference in New Issue
Block a user