Commit bf1c53e9 authored by Varun Gupta's avatar Varun Gupta

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
parent 3faed09d
...@@ -881,6 +881,7 @@ class Item: public Value_source, ...@@ -881,6 +881,7 @@ class Item: public Value_source,
*/ */
String *val_str() { return val_str(&str_value); } String *val_str() { return val_str(&str_value); }
virtual Item_func *get_item_func() { return NULL; } virtual Item_func *get_item_func() { return NULL; }
virtual Item_field *get_item_field() {return NULL;}
const MY_LOCALE *locale_from_val_str(); const MY_LOCALE *locale_from_val_str();
...@@ -3261,6 +3262,7 @@ class Item_field :public Item_ident, ...@@ -3261,6 +3262,7 @@ class Item_field :public Item_ident,
longlong val_int_endpoint(bool left_endp, bool *incl_endp); longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
bool get_date_result(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(); } bool is_null() { return field->is_null(); }
void update_null_value(); void update_null_value();
void update_table_bitmaps() void update_table_bitmaps()
......
...@@ -292,13 +292,14 @@ LEX::set_system_variable(enum enum_var_type var_type, ...@@ -292,13 +292,14 @@ LEX::set_system_variable(enum enum_var_type var_type,
Item *val) Item *val)
{ {
set_var *setvar; set_var *setvar;
Item_field *item_field;
/* No AUTOCOMMIT from a stored function or trigger. */ /* No AUTOCOMMIT from a stored function or trigger. */
if (spcont && sysvar == Sys_autocommit_ptr) if (spcont && sysvar == Sys_autocommit_ptr)
sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
if (val && val->type() == Item::FIELD_ITEM && if (val && (item_field= val->get_item_field()) &&
((Item_field*)val)->table_name) item_field->table_name)
{ {
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), sysvar->name.str); my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), sysvar->name.str);
return TRUE; return TRUE;
......
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