summaryrefslogtreecommitdiff
path: root/sql/sql_analyse.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-08-20 15:24:13 +0300
committerSergey Vojtovich <svoj@mariadb.org>2015-08-21 10:40:51 +0400
commit1bae0d9e5669c2d03209082142e892417e24d09a (patch)
tree8702469bab1f515c78a06ede07ae4aeaa297c802 /sql/sql_analyse.cc
parent31e365efae28ba3208e80511c4d18fe11a79541a (diff)
downloadmariadb-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/sql_analyse.cc')
-rw-r--r--sql/sql_analyse.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index e9f43a50fce..fe0834e4d47 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -1168,22 +1168,24 @@ int collect_ulonglong(ulonglong *element,
bool analyse::change_columns(THD *thd, List<Item> &field_list)
{
+ MEM_ROOT *mem_root= thd->mem_root;
field_list.empty();
- func_items[0] = new Item_proc_string(thd, "Field_name", 255);
- func_items[1] = new Item_proc_string(thd, "Min_value", 255);
+ func_items[0]= new (mem_root) Item_proc_string(thd, "Field_name", 255);
+ func_items[1]= new (mem_root) Item_proc_string(thd, "Min_value", 255);
func_items[1]->maybe_null = 1;
- func_items[2] = new Item_proc_string(thd, "Max_value", 255);
+ func_items[2]= new (mem_root) Item_proc_string(thd, "Max_value", 255);
func_items[2]->maybe_null = 1;
- func_items[3] = new Item_proc_int(thd, "Min_length");
- func_items[4] = new Item_proc_int(thd, "Max_length");
- func_items[5] = new Item_proc_int(thd, "Empties_or_zeros");
- func_items[6] = new Item_proc_int(thd, "Nulls");
- func_items[7] = new Item_proc_string(thd, "Avg_value_or_avg_length", 255);
- func_items[8] = new Item_proc_string(thd, "Std", 255);
+ func_items[3]= new (mem_root) Item_proc_int(thd, "Min_length");
+ func_items[4]= new (mem_root) Item_proc_int(thd, "Max_length");
+ func_items[5]= new (mem_root) Item_proc_int(thd, "Empties_or_zeros");
+ func_items[6]= new (mem_root) Item_proc_int(thd, "Nulls");
+ func_items[7]= new (mem_root) Item_proc_string(thd, "Avg_value_or_avg_length", 255);
+ func_items[8]= new (mem_root) Item_proc_string(thd, "Std", 255);
func_items[8]->maybe_null = 1;
- func_items[9] = new Item_proc_string(thd, "Optimal_fieldtype",
- MY_MAX(64, output_str_length));
+ func_items[9]= new (mem_root) Item_proc_string(thd, "Optimal_fieldtype",
+ MY_MAX(64,
+ output_str_length));
for (uint i = 0; i < array_elements(func_items); i++)
field_list.push_back(func_items[i]);