MDEV-19237 - small performance tweak

Avoid calling constructor for Protocol_text, if not necessary.
This commit is contained in:
Vladislav Vaintroub 2021-05-09 13:23:22 +02:00
parent 916b237b3f
commit fbad1b1150

View file

@ -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);