From ac11fb9222f247db4da007abc78aae5d0c691ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Mat=C5=82aszek?= Date: Wed, 4 Feb 2015 23:45:22 +0100 Subject: [PATCH] Write use statement to every slowlog entry --- sql/log.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index d322abcd742d..a2a15f2f843d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2737,11 +2737,10 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, (ulong) thd->sent_row_count, (ulong) thd->examined_row_count) == (uint) -1) tmp_errno= errno; - if (thd->db && strcmp(thd->db, db)) - { // Database changed + if (thd->db) + { // Write use statement to every log entry if (my_b_printf(&log_file,"use %s;\n",thd->db) == (uint) -1) tmp_errno= errno; - strmov(db,thd->db); } if (thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt) {