summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-06-01 21:52:20 +0200
committerSergei Golubchik <sergii@pisem.net>2010-06-01 21:52:20 +0200
commitffc8f62b08982cc1f2fabf8b4b38bd124c115a97 (patch)
treeda42637b1ae9402a7436b715f9c0db57cdddc87a /client/mysqlbinlog.cc
parent6b157f6be3cb056a93eb925df3880098c871b32a (diff)
parent0fc39acb8125fae95062e7b680b022b075a308c3 (diff)
downloadmariadb-git-ffc8f62b08982cc1f2fabf8b4b38bd124c115a97.tar.gz
merge 5.1->5.2
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc35
1 files changed, 19 insertions, 16 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 38e430f9f7b..d5e6799d1c9 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -777,10 +777,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case QUERY_EVENT:
{
Query_log_event *qe= (Query_log_event*)ev;
- if (strncmp(qe->query, "BEGIN", 5) &&
- strncmp(qe->query, "COMMIT", 6) &&
- strncmp(qe->query, "ROLLBACK", 8) &&
- shall_skip_database(qe->db))
+ if (!qe->is_trans_keyword() && shall_skip_database(qe->db))
goto end;
print_use_stmt(print_event_info, qe->db, qe->db_len);
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
@@ -881,7 +878,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
- ev->temp_buf= 0; // as the event ref is zeroed
+ if (!remote_opt)
+ ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
+ else
+ // disassociate but not free dump_remote_log_entries time memory
+ ev->temp_buf= 0;
/*
We don't want this event to be deleted now, so let's hide it (I
(Guilhem) should later see if this triggers a non-serious Valgrind
@@ -1048,7 +1049,7 @@ static struct my_option my_long_options[] =
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
+ {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"base64-output", OPT_BASE64_OUTPUT_MODE,
@@ -1072,7 +1073,7 @@ static struct my_option my_long_options[] =
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (uchar**) &charsets_dir,
+ "Directory for character set files.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
(uchar**) &database, (uchar**) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
@@ -1126,9 +1127,9 @@ static struct my_option my_long_options[] =
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
- "The protocol of connection (tcp,socket,pipe,memory).",
+ "The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
+ {"read-from-remote-server", 'R', "Read binary logs from a MySQL server.",
(uchar**) &remote_opt, (uchar**) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
@@ -1152,7 +1153,7 @@ static struct my_option my_long_options[] =
"using --base64-output=never instead.",
(uchar**) &short_form, (uchar**) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"socket", 'S', "Socket file to use for connection.",
+ {"socket", 'S', "The socket file to use for connection.",
(uchar**) &sock, (uchar**) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"start-datetime", OPT_START_DATETIME,
@@ -1194,12 +1195,12 @@ that may lead to an endless loop.",
(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",
+ "-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,
- "Used to reserve file descriptors for usage by this program",
+ "Used to reserve file descriptors for use by this program.",
(uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
{"rewrite-db", OPT_REWRITE_DB,
@@ -1302,11 +1303,11 @@ static void usage()
print_version();
puts("By Monty and Sasha, for your professional use\n\
This software comes with NO WARRANTY: This is free software,\n\
-and you are welcome to modify and redistribute it under the GPL license\n");
+and you are welcome to modify and redistribute it under the GPL license.\n");
printf("\
Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
-the mysql command line client\n\n");
+the mysql command line client.\n\n");
printf("Usage: %s [options] log-files\n", my_progname);
my_print_help(my_long_options);
my_print_variables(my_long_options);
@@ -1472,7 +1473,6 @@ static int parse_args(int *argc, char*** argv)
int ho_error;
result_file = stdout;
- load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (debug_info_flag)
@@ -2142,8 +2142,11 @@ int main(int argc, char** argv)
exit(1);
}
+ if (load_defaults("my", load_default_groups, &argc, &argv))
+ exit(1);
+
+ defaults_argv= argv;
parse_args(&argc, (char***)&argv);
- defaults_argv=argv;
if (!argc)
{