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/events.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/events.cc')
-rw-r--r-- | sql/events.cc | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sql/events.cc b/sql/events.cc index 911a683b723..a346d02fc39 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -632,37 +632,43 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) List<Item> field_list; LEX_STRING sql_mode; const String *tz_name; - + MEM_ROOT *mem_root= thd->mem_root; DBUG_ENTER("send_show_create_event"); show_str.length(0); if (et->get_create_event(thd, &show_str)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string(thd, "Event", NAME_CHAR_LEN)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "Event", NAME_CHAR_LEN)); if (sql_mode_string_representation(thd, et->sql_mode, &sql_mode)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string(thd, "sql_mode", - (uint) sql_mode.length)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "sql_mode", + (uint) sql_mode.length)); tz_name= et->time_zone->get_name(); - field_list.push_back(new Item_empty_string(thd, "time_zone", - tz_name->length())); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "time_zone", tz_name->length())); - field_list.push_back(new Item_empty_string(thd, "Create Event", - show_str.length())); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "Create Event", + show_str.length())); - field_list.push_back( - new Item_empty_string(thd, "character_set_client", MY_CS_NAME_SIZE)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "character_set_client", + MY_CS_NAME_SIZE)); - field_list.push_back( - new Item_empty_string(thd, "collation_connection", MY_CS_NAME_SIZE)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "collation_connection", + MY_CS_NAME_SIZE)); - field_list.push_back( - new Item_empty_string(thd, "Database Collation", MY_CS_NAME_SIZE)); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "Database Collation", + MY_CS_NAME_SIZE)); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) |