summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/mysqlbinlog.cc111
1 files changed, 18 insertions, 93 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 870145e35e0..43d670737a0 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -114,7 +114,7 @@ static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static bool one_database=0, one_table=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0, opt_version= 0;
const char *base64_output_mode_names[]=
-{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
+{"NEVER", "AUTO", "UNSPEC", "DECODE-ROWS", NullS};
TYPELIB base64_output_mode_typelib=
{ array_elements(base64_output_mode_names) - 1, "",
base64_output_mode_names, NULL };
@@ -836,53 +836,6 @@ static bool shall_skip_table(const char *log_tblname)
strcmp(log_tblname, table);
}
-
-/**
- Prints the given event in base64 format.
-
- The header is printed to the head cache and the body is printed to
- the body cache of the print_event_info structure. This allows all
- base64 events corresponding to the same statement to be joined into
- one BINLOG statement.
-
- @param[in] ev Log_event to print.
- @param[in,out] result_file FILE to which the output will be written.
- @param[in,out] print_event_info Parameters and context state
- determining how to print.
-
- @retval ERROR_STOP An error occurred - the program should terminate.
- @retval OK_CONTINUE No error, the program should continue.
-*/
-static Exit_status
-write_event_header_and_base64(Log_event *ev, FILE *result_file,
- PRINT_EVENT_INFO *print_event_info)
-{
- IO_CACHE *head= &print_event_info->head_cache;
- IO_CACHE *body= &print_event_info->body_cache;
- DBUG_ENTER("write_event_header_and_base64");
-
- /* Write header and base64 output to cache */
- if (ev->print_header(head, print_event_info, FALSE))
- DBUG_RETURN(ERROR_STOP);
-
- DBUG_ASSERT(print_event_info->base64_output_mode == BASE64_OUTPUT_ALWAYS);
-
- if (ev->print_base64(body, print_event_info,
- print_event_info->base64_output_mode !=
- BASE64_OUTPUT_DECODE_ROWS))
- DBUG_RETURN(ERROR_STOP);
-
- /* Read data from cache and write to result file */
- if (copy_event_cache_to_file_and_reinit(head, result_file) ||
- copy_event_cache_to_file_and_reinit(body, result_file))
- {
- error("Error writing event to file.");
- DBUG_RETURN(ERROR_STOP);
- }
- DBUG_RETURN(OK_CONTINUE);
-}
-
-
static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
{
/*
@@ -1134,19 +1087,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
qe->flags|= LOG_EVENT_SUPPRESS_USE_F;
}
print_use_stmt(print_event_info, qe);
- if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
- {
- if ((retval= write_event_header_and_base64(ev, result_file,
- print_event_info)) !=
- OK_CONTINUE)
- goto end;
- }
- else
- {
- print_skip_replication_statement(print_event_info, ev);
- if (ev->print(result_file, print_event_info))
- goto err;
- }
+ print_skip_replication_statement(print_event_info, ev);
+ if (ev->print(result_file, print_event_info))
+ goto err;
if (head->error == -1)
goto err;
break;
@@ -1170,19 +1113,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT'
below.
*/
- if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
- {
- if ((retval= write_event_header_and_base64(ce, result_file,
- print_event_info)) !=
- OK_CONTINUE)
- goto end;
- }
- else
- {
- print_skip_replication_statement(print_event_info, ev);
- if (ce->print(result_file, print_event_info, TRUE))
- goto err;
- }
+ print_skip_replication_statement(print_event_info, ev);
+ if (ce->print(result_file, print_event_info, TRUE))
+ goto err;
// If this binlog is not 3.23 ; why this test??
if (glob_description_event->binlog_version >= 3)
{
@@ -1589,12 +1522,10 @@ static struct my_option my_options[] =
"--verbose option is also given; "
"'auto' prints base64 only when necessary (i.e., for row-based events and "
"format description events); "
- "'always' prints base64 whenever possible. "
- "--base64-output with no 'name' argument is equivalent to "
- "--base64-output=always and is also deprecated. If no "
- "--base64-output[=name] option is given at all, the default is 'auto'.",
+ "If no --base64-output=name option is given at all, the default is "
+ "'auto'.",
&opt_base64_output_mode_str, &opt_base64_output_mode_str,
- 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
number found in binlog to a charset name (to be able to print things
@@ -2038,20 +1969,15 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
stop_datetime= convert_str_to_timestamp(stop_datetime_str);
break;
case OPT_BASE64_OUTPUT_MODE:
- if (argument == NULL)
- opt_base64_output_mode= BASE64_OUTPUT_ALWAYS;
- else
- {
- int val;
+ int val;
- if ((val= find_type_with_warning(argument, &base64_output_mode_typelib,
- opt->name)) <= 0)
- {
- sf_leaking_memory= 1; /* no memory leak reports here */
- die();
- }
- opt_base64_output_mode= (enum_base64_output_mode) (val - 1);
+ if ((val= find_type_with_warning(argument, &base64_output_mode_typelib,
+ opt->name)) <= 0)
+ {
+ sf_leaking_memory= 1; /* no memory leak reports here */
+ die();
}
+ opt_base64_output_mode= (enum_base64_output_mode)(val - 1);
break;
case OPT_REWRITE_DB: // db_from->db_to
{
@@ -2901,8 +2827,7 @@ static Exit_status check_header(IO_CACHE* file,
(ulonglong)tmp_pos);
return ERROR_STOP;
}
- if (opt_base64_output_mode == BASE64_OUTPUT_AUTO
- || opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ if (opt_base64_output_mode == BASE64_OUTPUT_AUTO)
{
/*
process_event will delete *description_event and set it to