From fcc91895e8280342cf3c8656565aeaaac90ea0c3 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 20 Aug 2008 19:06:31 +0500 Subject: Bug#31455 mysqlbinlog don't print user readable info about RBR events Implementing -v command line parameter to mysqlbinlog to decode and print row events. mysql-test/include/mysqlbinlog_row_engine.inc mysql-test/r/mysqlbinlog_row.result mysql-test/r/mysqlbinlog_row_big.result mysql-test/r/mysqlbinlog_row_innodb.result mysql-test/r/mysqlbinlog_row_myisam.result mysql-test/r/mysqlbinlog_row_trans.result mysql-test/t/mysqlbinlog_row.test mysql-test/t/mysqlbinlog_row_big.test mysql-test/t/mysqlbinlog_row_innodb.test mysql-test/t/mysqlbinlog_row_myisam.test mysql-test/t/mysqlbinlog_row_trans.test Adding tests client/Makefile.am Adding new files to symlink client/mysqlbinlog.cc Adding -v option sql/log_event.cc Impelentations of the new methods sql/log_event.h Declaration of the new methods and member sql/mysql_priv.h Adding new function prototype sql/rpl_tblmap.cc Adding pre-processor conditions sql/rpl_tblmap.h Adding pre-processor conditions sql/rpl_utility.h Adding pre-processor conditions sql/sql_base.cc Adding reset_table_id_sequence() function. sql/sql_repl.cc Resetting table_id on "RESET MASTER" .bzrignore Ignoring new symlinked files --- client/mysqlbinlog.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'client/mysqlbinlog.cc') diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9f021115d5d..3c9ee0072f2 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -83,6 +83,8 @@ static const char* user = 0; static char* pass = 0; static char *charset= 0; +static uint verbose= 0; + static ulonglong start_position, stop_position; #define start_position_mot ((my_off_t)start_position) #define stop_position_mot ((my_off_t)stop_position) @@ -1063,6 +1065,9 @@ that may lead to an endless loop.", {"user", 'u', "Connect to the remote server as username.", (uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Reconstruct SQL statements out of row events. " + "-v -v adds comments on column data types", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"open_files_limit", OPT_OPEN_FILES_LIMIT, @@ -1258,6 +1263,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1); } break; + case 'v': + if (argument == disabled_my_option) + verbose= 0; + else + verbose++; + break; case 'V': print_version(); exit(0); @@ -1343,6 +1354,8 @@ static Exit_status dump_log_entries(const char* logname) */ fprintf(result_file, "DELIMITER /*!*/;\n"); strmov(print_event_info.delimiter, "/*!*/;"); + + print_event_info.verbose= short_form ? 0 : verbose; rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) : dump_local_log_entries(&print_event_info, logname)); -- cgit v1.2.1