summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 99fb08abcca..c2021710d6c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -812,11 +812,7 @@ bool do_command(THD *thd)
net_new_transaction(net);
- packet_length= my_net_read(net);
-#if defined(ENABLED_PROFILING)
- thd->profiling.start_new_query();
-#endif
- if (packet_length == packet_error)
+ if ((packet_length= my_net_read(net)) == packet_error)
{
DBUG_PRINT("info",("Got error %d reading command from socket %s",
net->error,
@@ -873,9 +869,6 @@ bool do_command(THD *thd)
return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
out:
-#if defined(ENABLED_PROFILING)
- thd->profiling.finish_current_query();
-#endif
DBUG_RETURN(return_value);
}
#endif /* EMBEDDED_LIBRARY */
@@ -977,6 +970,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_ENTER("dispatch_command");
DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command));
+#if defined(ENABLED_PROFILING)
+ thd->profiling.start_new_query();
+#endif
MYSQL_COMMAND_START(thd->thread_id, command,
thd->security_ctx->priv_user,
(char *) thd->security_ctx->host_or_ip);
@@ -1608,6 +1604,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+#if defined(ENABLED_PROFILING)
+ thd->profiling.finish_current_query();
+#endif
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
{
int res;