summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-05-09 13:23:22 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-05-09 13:23:22 +0200
commitfbad1b115025e2b8d919ee3cae8b5ba5785eb002 (patch)
tree303432261697875c1ea2dba603a719c7d58c6065
parent916b237b3f6ee4d8e113d480c53bca232cadbb7b (diff)
downloadmariadb-git-fbad1b115025e2b8d919ee3cae8b5ba5785eb002.tar.gz
MDEV-19237 - small performance tweak
Avoid calling constructor for Protocol_text, if not necessary.
-rw-r--r--sql/protocol.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index f369fa1c66f..d0566ed2506 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1168,9 +1168,6 @@ static bool should_send_column_info(THD* thd, List<Item>* list, uint flags)
*/
bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
{
- List_iterator_fast<Item> it(*list);
- Item *item;
- Protocol_text prot(thd, thd->variables.net_buffer_length);
DBUG_ENTER("Protocol::send_result_set_metadata");
bool send_column_info= should_send_column_info(thd, list, flags);
@@ -1195,6 +1192,9 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
if (send_column_info)
{
+ List_iterator_fast<Item> it(*list);
+ Item *item;
+ Protocol_text prot(thd, thd->variables.net_buffer_length);
#ifndef DBUG_OFF
field_handlers= (const Type_handler **) thd->alloc(
sizeof(field_handlers[0]) * list->elements);