diff options
author | lars@black.(none) <> | 2006-10-10 21:59:23 +0200 |
---|---|---|
committer | lars@black.(none) <> | 2006-10-10 21:59:23 +0200 |
commit | 0b4e65e12b1c2ac63a55f4ee1dc59dd7209c17ef (patch) | |
tree | 8540e483e880421e97e84bf91c84cd2320023353 /client | |
parent | 84e4df338d7e1dd4c30b1832d609486d838e7413 (diff) | |
parent | 1023aecb1c76042e6eba709fc45ff56921a51037 (diff) | |
download | mariadb-git-0b4e65e12b1c2ac63a55f4ee1dc59dd7209c17ef.tar.gz |
Merge mysql.com:/home/bkroot/mysql-5.1-new-rpl
into mysql.com:/home/bk/MERGE/mysql-5.1-merge
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlbinlog.cc | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 83385e9d005..ab94c415db7 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -476,6 +476,30 @@ static bool check_database(const char *log_dbname) } + +static int +write_event_header_and_base64(Log_event *ev, FILE *result_file, + PRINT_EVENT_INFO *print_event_info) +{ + DBUG_ENTER("write_event_header_and_base64"); + /* Write header and base64 output to cache */ + IO_CACHE result_cache; + if (init_io_cache(&result_cache, -1, 0, WRITE_CACHE, 0L, FALSE, + MYF(MY_WME | MY_NABP))) + { + return 1; + } + + ev->print_header(&result_cache, print_event_info, FALSE); + ev->print_base64(&result_cache, print_event_info, FALSE); + + /* Read data from cache and write to result file */ + my_b_copy_to_file(&result_cache, result_file); + end_io_cache(&result_cache); + DBUG_RETURN(0); +} + + /* Process an event @@ -538,18 +562,18 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, print_event_info->base64_output= opt_base64_output; + DBUG_PRINT("debug", ("event_type: %s", ev->get_type_str())); + switch (ev_type) { case QUERY_EVENT: if (check_database(((Query_log_event*)ev)->db)) goto end; if (opt_base64_output) - { - ev->print_header(result_file, print_event_info); - ev->print_base64(result_file, print_event_info); - } + write_event_header_and_base64(ev, result_file, print_event_info); else ev->print(result_file, print_event_info); break; + case CREATE_FILE_EVENT: { Create_file_log_event* ce= (Create_file_log_event*)ev; @@ -570,8 +594,7 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, */ if (opt_base64_output) { - ce->print_header(result_file, print_event_info); - ce->print_base64(result_file, print_event_info); + write_event_header_and_base64(ce, result_file, print_event_info); } else ce->print(result_file, print_event_info, TRUE); |