From e676faa7891f83f7b4049ffd8178322e95a06ebc Mon Sep 17 00:00:00 2001 From: "georg@lmy002.wdf.sap.corp" <> Date: Wed, 27 Jul 2005 12:45:32 +0200 Subject: [PATCH] fix for bug#9968 (slow query log contains useless entries) Query has to be written to the log before calling thd->set_statement(&stmt_backup), otherwise query will be empty. Setting thd->enabe_slow_log to FALSE prevents that dispatch_command logs the (empty) query again. --- sql/sql_prepare.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index cec432a86be..ed1a1d67e88 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2079,6 +2079,10 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) reset_stmt_params(stmt); } + log_slow_statement(thd); + /* Prevent from second logging in the end of dispatch_command */ + thd->enable_slow_log= FALSE; + thd->set_statement(&stmt_backup); thd->lock_id= &thd->main_lock_id; thd->current_arena= thd;