summaryrefslogtreecommitdiff
path: root/sql/table.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/table.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/table.cc')
-rw-r--r--sql/table.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 9beada2667f..f768cf93061 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4142,7 +4142,7 @@ bool TABLE::fill_item_list(List<Item> *item_list) const
*/
for (Field **ptr= field; *ptr; ptr++)
{
- Item_field *item= new Item_field(in_use, *ptr);
+ Item_field *item= new (in_use->mem_root) Item_field(in_use, *ptr);
if (!item || item_list->push_back(item))
return TRUE;
}
@@ -5297,7 +5297,7 @@ Item *Field_iterator_table::create_item(THD *thd)
{
SELECT_LEX *select= thd->lex->current_select;
- Item_field *item= new Item_field(thd, &select->context, *ptr);
+ Item_field *item= new (thd->mem_root) Item_field(thd, &select->context, *ptr);
if (item && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
!thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS)
{
@@ -5354,7 +5354,7 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
{
DBUG_RETURN(field);
}
- Item *item= new Item_direct_view_ref(thd, &view->view->select_lex.context,
+ Item *item= new (thd->mem_root) Item_direct_view_ref(thd, &view->view->select_lex.context,
field_ref, view->alias,
name, view);
/*
@@ -5559,7 +5559,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
/* The field belongs to a stored table. */
Field *tmp_field= table_field_it.field();
Item_field *tmp_item=
- new Item_field(thd, &thd->lex->current_select->context, tmp_field);
+ new (thd->mem_root) Item_field(thd, &thd->lex->current_select->context, tmp_field);
if (!tmp_item)
return NULL;
nj_col= new Natural_join_column(tmp_item, table_ref);
@@ -7328,7 +7328,7 @@ bool TABLE_LIST::change_refs_to_fields()
DBUG_ASSERT(!field_it.end_of_fields());
if (!materialized_items[idx])
{
- materialized_items[idx]= new Item_field(thd, table->field[idx]);
+ materialized_items[idx]= new (thd->mem_root) Item_field(thd, table->field[idx]);
if (!materialized_items[idx])
return TRUE;
}