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/handler.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/handler.cc')
-rw-r--r-- | sql/handler.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index e2c24c7842a..eec6e5c1212 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1981,16 +1981,21 @@ bool mysql_xa_recover(THD *thd) { List<Item> field_list; Protocol *protocol= thd->protocol; + MEM_ROOT *mem_root= thd->mem_root; DBUG_ENTER("mysql_xa_recover"); - field_list.push_back(new Item_int(thd, "formatID", 0, - MY_INT32_NUM_DECIMAL_DIGITS)); - field_list.push_back(new Item_int(thd, "gtrid_length", 0, - MY_INT32_NUM_DECIMAL_DIGITS)); - field_list.push_back(new Item_int(thd, "bqual_length", 0, - MY_INT32_NUM_DECIMAL_DIGITS)); - field_list.push_back(new Item_empty_string(thd, "data", - XIDDATASIZE)); + field_list.push_back(new (mem_root) + Item_int(thd, "formatID", 0, + MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new (mem_root) + Item_int(thd, "gtrid_length", 0, + MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new (mem_root) + Item_int(thd, "bqual_length", 0, + MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "data", + XIDDATASIZE)); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -5525,11 +5530,12 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) { List<Item> field_list; Protocol *protocol= thd->protocol; + MEM_ROOT *mem_root= thd->mem_root; bool result; - field_list.push_back(new Item_empty_string(thd, "Type", 10)); - field_list.push_back(new Item_empty_string(thd, "Name", FN_REFLEN)); - field_list.push_back(new Item_empty_string(thd, "Status", 10)); + field_list.push_back(new (mem_root) Item_empty_string(thd, "Type", 10)); + field_list.push_back(new (mem_root) Item_empty_string(thd, "Name", FN_REFLEN)); + field_list.push_back(new (mem_root) Item_empty_string(thd, "Status", 10)); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) |