Commit 374deedd authored by unknown's avatar unknown

mysqlbinlog --hexdump additional patch 2

- Fixes related to Guilhems review
- Special printing of event header


client/mysqlbinlog.cc:
  Fixes of option --hexdump handling
sql/log_event.cc:
  Fixes related to Guilhems review
  Special printing of event header
sql/log_event.h:
  Fixes related to Guilhems review
parent d2b5d5a4
......@@ -525,7 +525,7 @@ int process_event(LAST_EVENT_INFO *last_event_info, Log_event *ev,
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
/* Set pos to 0 if hexdump is disabled */
pos= (opt_hexdump ? pos : 0);
if (!opt_hexdump) pos= 0;
switch (ev_type) {
case QUERY_EVENT:
......@@ -674,8 +674,9 @@ static struct my_option my_long_options[] =
0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ascii data dump.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
(gptr*) &opt_hexdump, (gptr*) &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
......@@ -855,9 +856,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'd':
one_database = 1;
break;
case 'H':
opt_hexdump= 1;
break;
case 'p':
if (argument)
{
......
This diff is collapsed.
......@@ -589,10 +589,10 @@ class Log_event
static Log_event* read_log_event(IO_CACHE* file,
const Format_description_log_event *description_event);
/* print*() functions are used by mysqlbinlog */
virtual void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
virtual void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0) = 0;
void print_timestamp(FILE* file, time_t *ts = 0);
void print_header(FILE* file, my_off_t start_pos= 0);
void print_header(FILE* file, my_off_t hexdump_from= 0);
#endif
static void *operator new(size_t size)
......@@ -753,9 +753,9 @@ class Query_log_event: public Log_event
#endif /* HAVE_REPLICATION */
#else
void print_query_header(FILE* file, bool short_form= 0,
my_off_t start_pos= 0,
my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -810,7 +810,7 @@ class Slave_log_event: public Log_event
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -899,9 +899,9 @@ class Load_log_event: public Log_event
bool use_rli_only_for_errors);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info = 0);
void print(FILE* file, bool short_form, my_off_t start_pos,
void print(FILE* file, bool short_form, my_off_t hexdump_from,
LAST_EVENT_INFO* last_event_info, bool commented);
#endif
......@@ -991,7 +991,7 @@ class Start_log_event_v3: public Log_event
#endif /* HAVE_REPLICATION */
#else
Start_log_event_v3() {}
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1087,7 +1087,7 @@ class Intvar_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1129,7 +1129,7 @@ class Rand_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1167,7 +1167,7 @@ class Xid_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1210,7 +1210,7 @@ class User_var_log_event: public Log_event
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1237,7 +1237,7 @@ class Stop_log_event: public Log_event
{}
int exec_event(struct st_relay_log_info* rli);
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1277,7 +1277,7 @@ class Rotate_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1331,9 +1331,9 @@ class Create_file_log_event: public Load_log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
void print(FILE* file, bool short_form, my_off_t start_pos,
void print(FILE* file, bool short_form, my_off_t hexdump_from,
LAST_EVENT_INFO* last_event_info, bool enable_local);
#endif
......@@ -1401,7 +1401,7 @@ class Append_block_log_event: public Log_event
virtual int get_create_or_append() const;
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1437,9 +1437,9 @@ class Delete_file_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
void print(FILE* file, bool short_form, my_off_t start_pos,
void print(FILE* file, bool short_form, my_off_t hexdump_from,
LAST_EVENT_INFO* last_event_info, bool enable_local);
#endif
......@@ -1475,7 +1475,7 @@ class Execute_load_log_event: public Log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
#endif
......@@ -1561,10 +1561,10 @@ class Execute_load_query_log_event: public Query_log_event
int exec_event(struct st_relay_log_info* rli);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
/* Prints the query as LOAD DATA LOCAL and with rewritten filename */
void print(FILE* file, bool short_form, my_off_t start_pos,
void print(FILE* file, bool short_form, my_off_t hexdump_from,
LAST_EVENT_INFO* last_event_info, const char *local_fname);
#endif
Execute_load_query_log_event(const char* buf, uint event_len,
......@@ -1594,7 +1594,7 @@ class Unknown_log_event: public Log_event
Log_event(buf, description_event)
{}
~Unknown_log_event() {}
void print(FILE* file, bool short_form= 0, my_off_t start_pos= 0,
void print(FILE* file, bool short_form= 0, my_off_t hexdump_from= 0,
LAST_EVENT_INFO* last_event_info= 0);
Log_event_type get_type_code() { return UNKNOWN_EVENT;}
bool is_valid() const { return 1; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment