diff options
author | unknown <guilhem@mysql.com> | 2003-08-19 15:46:47 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-08-19 15:46:47 +0200 |
commit | fe0e54643492c6b689664ed09206db58dca29967 (patch) | |
tree | 96fc3e34d0ad8c0c6612d46fb6ce4ffa5977b7ab /sql/log_event.cc | |
parent | 4392456beab4790ac14a05862fd85aec592fba10 (diff) | |
download | mariadb-git-fe0e54643492c6b689664ed09206db58dca29967.tar.gz |
Fix for BUG#1096 which is:
"mysqlbinlog does not comment the original LOAD DATA INFILE if it has a "use xx""
client/mysqlbinlog.cc:
a comment
sql/log_event.cc:
in mysqlbinlog we want to have a leading '#' before LOAD DATA INFILE when we
print a Create_file event.
This was not done properly when the query had *2* lines: only the "use db" got
commented.
To fix this I had to add an argument to Load_log_event::print, it could not be
handled in Create_file_log_event::print alone.
sql/log_event.h:
prototype
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 3451ffab65f..591ebf2b5d8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1280,6 +1280,11 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, void Load_log_event::print(FILE* file, bool short_form, char* last_db) { + print(file, short_form, last_db, 0); +} + +void Load_log_event::print(FILE* file, bool short_form, char* last_db, bool commented) +{ if (!short_form) { print_header(file); @@ -1295,9 +1300,12 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) } if (db && db[0] && !same_db) - fprintf(file, "use %s;\n", db); + fprintf(file, "%suse %s;\n", + commented ? "# " : "", + db); - fprintf(file, "LOAD DATA "); + fprintf(file, "%sLOAD DATA ", + commented ? "# " : ""); if (check_fname_outside_temp_buf()) fprintf(file, "LOCAL "); fprintf(file, "INFILE '%-*s' ", fname_len, fname); @@ -1573,10 +1581,12 @@ void Create_file_log_event::print(FILE* file, bool short_form, if (enable_local) { - if (!check_fname_outside_temp_buf()) - fprintf(file, "#"); - Load_log_event::print(file, 1, last_db); - fprintf(file, "#"); + Load_log_event::print(file, 1, last_db, !check_fname_outside_temp_buf()); + /* + That one is for "file_id: etc" below: in mysqlbinlog we want the #, in + SHOW BINLOG EVENTS we don't. + */ + fprintf(file, "#"); } fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len); |