diff options
author | Monty <monty@mariadb.org> | 2015-08-20 15:24:13 +0300 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-21 10:40:51 +0400 |
commit | 1bae0d9e5669c2d03209082142e892417e24d09a (patch) | |
tree | 8702469bab1f515c78a06ede07ae4aeaa297c802 /sql/set_var.cc | |
parent | 31e365efae28ba3208e80511c4d18fe11a79541a (diff) | |
download | mariadb-git-1bae0d9e5669c2d03209082142e892417e24d09a.tar.gz |
Stage 2 of MDEV-6152:
- Added mem_root to all calls to new Item
- Added private method operator new(size_t size) to Item to ensure that
we always use a mem_root when creating an item.
This saves use once call to current_thd per Item creation
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 *****************************************************************************/ |