summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-02-16 10:15:52 +0200
committerunknown <monty@mysql.com>2004-02-16 10:15:52 +0200
commitd00fbce3083f11d071300447e11dab124debb2b7 (patch)
treef9bef14abcf4ef1e6145cb3c16e63c9a56e221e9 /sql/log_event.cc
parenta07e48eca04b1564da9868f229ba5d958994db69 (diff)
parent40ad9154930ca5d42649b776f84989cc372b060c (diff)
downloadmariadb-git-d00fbce3083f11d071300447e11dab124debb2b7.tar.gz
Merge with 4.0 to get fix for mysqlbinlog
mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/select_found.result: Auto merged mysql-test/t/select_found.test: Auto merged sql/log_event.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_load.cc: Auto merged support-files/mysql.spec.sh: Auto merged client/mysqlbinlog.cc: Merge with 4.0 configure.in: Merge with 4.0 mysql-test/r/range.result: Use local file mysql-test/t/range.test: Use local file sql/share/english/errmsg.txt: Use local file
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f64f740da30..a128b5809b2 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1218,7 +1218,7 @@ void Load_log_event::pack_info(Protocol *protocol)
18 + fname_len + 2 + // "LOAD DATA INFILE 'file''"
7 + // LOCAL
9 + // " REPLACE or IGNORE "
- 11 + table_name_len + // "INTO TABLE table"
+ 13 + table_name_len*2 + // "INTO TABLE `table`"
21 + sql_ex.field_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
23 + sql_ex.enclosed_len*4 + 2 + // " OPTIONALLY ENCLOSED BY 'str'"
12 + sql_ex.escaped_len*4 + 2 + // " ESCAPED BY 'str'"
@@ -1249,12 +1249,12 @@ void Load_log_event::pack_info(Protocol *protocol)
else if (sql_ex.opt_flags & IGNORE_FLAG)
pos= strmov(pos, " IGNORE ");
- pos= strmov(pos ,"INTO TABLE ");
+ pos= strmov(pos ,"INTO TABLE `");
memcpy(pos, table_name, table_name_len);
pos+= table_name_len;
/* We have to create all optinal fields as the default is not empty */
- pos= strmov(pos, " FIELDS TERMINATED BY ");
+ pos= strmov(pos, "` FIELDS TERMINATED BY ");
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
pos= strmov(pos, " OPTIONALLY ");
@@ -1545,7 +1545,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
else if (sql_ex.opt_flags & IGNORE_FLAG)
fprintf(file," IGNORE ");
- fprintf(file, "INTO TABLE %s ", table_name);
+ fprintf(file, "INTO TABLE `%s`", table_name);
fprintf(file, " FIELDS TERMINATED BY ");
pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
@@ -2570,7 +2570,7 @@ Create_file_log_event(THD* thd_arg, sql_exchange* ex,
char* block_arg, uint block_len_arg, bool using_trans)
:Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup,
using_trans),
- fake_base(0),block(block_arg),block_len(block_len_arg),
+ fake_base(0), block(block_arg), event_buf(0), block_len(block_len_arg),
file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
{
DBUG_ENTER("Create_file_log_event");
@@ -2634,8 +2634,14 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len,
int block_offset;
DBUG_ENTER("Create_file_log_event");
- if (copy_log_event(buf,len,old_format))
+ /*
+ We must make copy of 'buf' as this event may have to live over a
+ rotate log entry when used in mysqlbinlog
+ */
+ if (!(event_buf= my_memdup(buf, len, MYF(MY_WME))) ||
+ (copy_log_event(event_buf, len, old_format)))
DBUG_VOID_RETURN;
+
if (!old_format)
{
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN +