diff options
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 53a7d2ad39a..24e4e63e9cf 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -788,12 +788,33 @@ int set_var::light_check(THD *thd) Consider set_var::check() method if there is a need to return an error due to logics. */ + int set_var::update(THD *thd) { return value ? var->update(thd, this) : var->set_default(thd, this); } +set_var::set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg, + const LEX_STRING *base_name_arg, Item *value_arg) + :var(var_arg), type(type_arg), base(*base_name_arg) +{ + /* + If the set value is a field, change it to a string to allow things like + SET table_type=MYISAM; + */ + if (value_arg && value_arg->type() == Item::FIELD_ITEM) + { + Item_field *item= (Item_field*) value_arg; + // names are utf8 + if (!(value= new (thd->mem_root) Item_string_sys(thd, item->field_name))) + value=value_arg; /* Give error message later */ + } + else + value=value_arg; +} + + /***************************************************************************** Functions to handle SET @user_variable=const_expr *****************************************************************************/ |