diff options
author | Monty <monty@mariadb.org> | 2015-08-24 14:42:07 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-08-27 22:21:08 +0300 |
commit | 3cb578c001b2feabd2410f281d20eb6566371453 (patch) | |
tree | 4e3781e38f6531ea91ff127c024869c6b88c5849 /sql/sql_profile.cc | |
parent | ba340d8c47657774ba6d69bfc918dbebaaef6086 (diff) | |
download | mariadb-git-3cb578c001b2feabd2410f281d20eb6566371453.tar.gz |
MDEV-6152: Remove calls to current_thd while creating Item
- Part 3: Adding mem_root to push_back() and push_front()
Other things:
- Added THD as an argument to some partition functions.
- Added memory overflow checking for XML tag's in read_xml()
Diffstat (limited to 'sql/sql_profile.cc')
-rw-r--r-- | sql/sql_profile.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 28ceccc695a..bc11f5fdb21 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -386,30 +386,35 @@ void PROFILING::finish_current_query_impl() bool PROFILING::show_profiles() { - DBUG_ENTER("PROFILING::show_profiles"); QUERY_PROFILE *prof; List<Item> field_list; MEM_ROOT *mem_root= thd->mem_root; - - field_list.push_back(new (mem_root) Item_return_int(thd, "Query_ID", 10, - MYSQL_TYPE_LONG)); - field_list.push_back(new (mem_root) Item_return_int(thd, "Duration", - TIME_FLOAT_DIGITS - 1, - MYSQL_TYPE_DOUBLE)); - field_list.push_back(new (mem_root) Item_empty_string(thd, "Query", 40)); - - if (thd->protocol->send_result_set_metadata(&field_list, - Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(TRUE); - SELECT_LEX *sel= &thd->lex->select_lex; SELECT_LEX_UNIT *unit= &thd->lex->unit; ha_rows idx= 0; Protocol *protocol= thd->protocol; + void *iterator; + DBUG_ENTER("PROFILING::show_profiles"); + + field_list.push_back(new (mem_root) + Item_return_int(thd, "Query_ID", 10, + MYSQL_TYPE_LONG), + mem_root); + field_list.push_back(new (mem_root) + Item_return_int(thd, "Duration", + TIME_FLOAT_DIGITS - 1, + MYSQL_TYPE_DOUBLE), + mem_root); + field_list.push_back(new (mem_root) Item_empty_string(thd, "Query", 40), + mem_root); + + if (protocol->send_result_set_metadata(&field_list, + Protocol::SEND_NUM_ROWS | + Protocol::SEND_EOF)) + DBUG_RETURN(TRUE); unit->set_limit(sel); - void *iterator; for (iterator= history.new_iterator(); iterator != NULL; iterator= history.iterator_next(iterator)) |