diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-11 11:18:38 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-21 10:40:39 +0400 |
commit | 31e365efae28ba3208e80511c4d18fe11a79541a (patch) | |
tree | f249682cc42490fc86382f5244a051001dc13c9e /sql/sql_help.cc | |
parent | 4374da63f03abc472f68f42e4e93261a18bfe417 (diff) | |
download | mariadb-git-31e365efae28ba3208e80511c4d18fe11a79541a.tar.gz |
MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor.
Added thd parameter to all routines that may create items.
Also removed "current_thd" from Item::Item. This reduced number of
pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
Diffstat (limited to 'sql/sql_help.cc')
-rw-r--r-- | sql/sql_help.cc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 50ce8a51f01..0c74f3385eb 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -449,11 +449,12 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3) { + THD *thd= protocol->thd; DBUG_ENTER("send_answer_1"); List<Item> field_list; - field_list.push_back(new Item_empty_string("name",64)); - field_list.push_back(new Item_empty_string("description",1000)); - field_list.push_back(new Item_empty_string("example",1000)); + field_list.push_back(new Item_empty_string(thd, "name", 64)); + field_list.push_back(new Item_empty_string(thd, "description", 1000)); + field_list.push_back(new Item_empty_string(thd, "example", 1000)); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -492,12 +493,14 @@ int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3) int send_header_2(Protocol *protocol, bool for_category) { + THD *thd= protocol->thd; DBUG_ENTER("send_header_2"); List<Item> field_list; if (for_category) - field_list.push_back(new Item_empty_string("source_category_name",64)); - field_list.push_back(new Item_empty_string("name",64)); - field_list.push_back(new Item_empty_string("is_it_category",1)); + field_list.push_back(new Item_empty_string(thd, "source_category_name", + 64)); + field_list.push_back(new Item_empty_string(thd, "name", 64)); + field_list.push_back(new Item_empty_string(thd, "is_it_category", 1)); DBUG_RETURN(protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)); } @@ -625,9 +628,10 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen, TABLE_LIST *tables, TABLE *table, Field *pfname, int *error) { - Item *cond= new Item_func_like(new Item_field(pfname), - new Item_string(mask,mlen,pfname->charset()), - new Item_string_ascii("\\"), + Item *cond= new Item_func_like(thd, new Item_field(thd, pfname), + new Item_string(thd, mask, mlen, + pfname->charset()), + new Item_string_ascii(thd, "\\"), FALSE); if (thd->is_fatal_error) return 0; // OOM @@ -763,11 +767,11 @@ bool mysqld_help(THD *thd, const char *mask) { Field *topic_cat_id= used_fields[help_topic_help_category_id].field; Item *cond_topic_by_cat= - new Item_func_equal(new Item_field(topic_cat_id), - new Item_int((int32)category_id)); + new Item_func_equal(thd, new Item_field(thd, topic_cat_id), + new Item_int(thd, (int32) category_id)); Item *cond_cat_by_cat= - new Item_func_equal(new Item_field(cat_cat_id), - new Item_int((int32)category_id)); + new Item_func_equal(thd, new Item_field(thd, cat_cat_id), + new Item_int(thd, (int32) category_id)); if (!(select= prepare_simple_select(thd, cond_topic_by_cat, tables[0].table, &error))) goto error; |