Commit bf19d02b authored by lars@mysql.com's avatar lars@mysql.com

mysqlbinlog --hexdump additional patch 2

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