Fixed ASAN failure for the test main.func_misc.
For Item name_const , we should never do typecast it to Item_field because we always expect it to be a constant value. So instead of checking the type() its better to introduce a function in the Item class get_item_field, which would return the item_field object for the item which have type of FIELD_ITEM
This commit is contained in:
parent
3faed09d6d
commit
bf1c53e9be
@ -881,6 +881,7 @@ public:
|
||||
*/
|
||||
String *val_str() { return val_str(&str_value); }
|
||||
virtual Item_func *get_item_func() { return NULL; }
|
||||
virtual Item_field *get_item_field() {return NULL;}
|
||||
|
||||
const MY_LOCALE *locale_from_val_str();
|
||||
|
||||
@ -3261,6 +3262,7 @@ public:
|
||||
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
|
||||
bool get_date_result(MYSQL_TIME *ltime,ulonglong fuzzydate);
|
||||
Item_field* get_item_field() {return this;}
|
||||
bool is_null() { return field->is_null(); }
|
||||
void update_null_value();
|
||||
void update_table_bitmaps()
|
||||
|
@ -292,13 +292,14 @@ LEX::set_system_variable(enum enum_var_type var_type,
|
||||
Item *val)
|
||||
{
|
||||
set_var *setvar;
|
||||
Item_field *item_field;
|
||||
|
||||
/* No AUTOCOMMIT from a stored function or trigger. */
|
||||
if (spcont && sysvar == Sys_autocommit_ptr)
|
||||
sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
|
||||
|
||||
if (val && val->type() == Item::FIELD_ITEM &&
|
||||
((Item_field*)val)->table_name)
|
||||
if (val && (item_field= val->get_item_field()) &&
|
||||
item_field->table_name)
|
||||
{
|
||||
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), sysvar->name.str);
|
||||
return TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user