summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2014-08-03 15:26:47 +0300
committerMonty <monty@mariadb.org>2014-08-09 13:22:01 +0300
commite2b2bde358f434d945e9730acfbc6eedeb9ab8a2 (patch)
treef7309ce86e95b4f4bd20e84065fe892e83a0f625 /client
parent7375f025ee9cd39909c1ec5529ca8c4007b92368 (diff)
downloadmariadb-git-e2b2bde358f434d945e9730acfbc6eedeb9ab8a2.tar.gz
Made sql_log_slow a session variable
mysqldump: - Added --log-queries to allow one to disable logging for the dump sql/log_event.cc: - Removed setting of enable_slow_log as it's not required anymore. sql/sql_parse.cc: - Set enable_slow_log to value of thd->variables.sql_log_slow as this will speed up tests if slow log is disabled. - opt_log_slow_admin_statements can now only disable slow log, not enable it. sql/sql_explain.cc: - Minor cleanup Other things: - Added sql_log_slow to system variables. - Changed opt_slow_log to global_system_variables.sql_log_slow in all files - Updated tests to reflect changes
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index cb4fa022d4f..db2813158b0 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -39,7 +39,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
-#define DUMP_VERSION "10.15"
+#define DUMP_VERSION "10.16"
#include <my_global.h>
#include <my_sys.h>
@@ -111,7 +111,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
opt_slave_apply= 0,
opt_include_master_host_port= 0,
opt_events= 0, opt_comments_used= 0,
- opt_alltspcs=0, opt_notspcs= 0;
+ opt_alltspcs=0, opt_notspcs= 0, opt_logging;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
@@ -381,6 +381,8 @@ static struct my_option my_long_options[] =
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
&log_error_file, &log_error_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"log-queries", 0, "When restoring the dump, the server will, if logging turned on, log the queries to the general and slow query log.",
+ &opt_logging, &opt_logging, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
@@ -663,6 +665,10 @@ static void write_header(FILE *sql_file, char *db_name)
print_comment(sql_file, 0, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
+ if (!opt_logging)
+ fprintf(sql_file,
+"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL SLOW_QUERY_LOG=0 */;");
+
if (opt_set_charset)
fprintf(sql_file,
"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"