diff options
Diffstat (limited to 'sql/log_event_server.cc')
-rw-r--r-- | sql/log_event_server.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 77cab26cdbf..6ed79fa6b48 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -517,6 +517,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to, const char *str, size_t len, bool no_backslash) { char *beg, *ptr; + my_bool overflow; uint32 const orig_len= to->length(); if (to->reserve(orig_len + len * 2 + 4)) return 1; @@ -530,7 +531,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to, *ptr++= '\''; if (!no_backslash) { - ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len); + ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len, &overflow); } else { @@ -660,7 +661,7 @@ Log_event::do_shall_skip(rpl_group_info *rgi) void Log_event::pack_info(Protocol *protocol) { - protocol->store("", &my_charset_bin); + protocol->store("", 0, &my_charset_bin); } @@ -675,7 +676,7 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos) log_name = p + 1; protocol->prepare_for_resend(); - protocol->store(log_name, &my_charset_bin); + protocol->store(log_name, strlen(log_name), &my_charset_bin); protocol->store((ulonglong) pos); event_type = get_type_str(); protocol->store(event_type, strlen(event_type), &my_charset_bin); @@ -4132,9 +4133,9 @@ static bool user_var_append_name_part(THD *thd, String *buf, const char *name, size_t name_len) { - return buf->append("@") || + return buf->append('@') || append_identifier(thd, buf, name, name_len) || - buf->append("="); + buf->append('='); } void User_var_log_event::pack_info(Protocol* protocol) @@ -4145,7 +4146,7 @@ void User_var_log_event::pack_info(Protocol* protocol) String buf(buf_mem, sizeof(buf_mem), system_charset_info); buf.length(0); if (user_var_append_name_part(protocol->thd, &buf, name, name_len) || - buf.append("NULL")) + buf.append(NULL_clex_str)) return; protocol->store(buf.ptr(), buf.length(), &my_charset_bin); } @@ -4190,9 +4191,10 @@ void User_var_log_event::pack_info(Protocol* protocol) buf.length(0); my_decimal((const uchar *) (val + 2), val[0], val[1]).to_string(&str); if (user_var_append_name_part(protocol->thd, &buf, name, name_len) || - buf.append(buf2)) + buf.append(str)) return; protocol->store(buf.ptr(), buf.length(), &my_charset_bin); + break; } case STRING_RESULT: @@ -4204,7 +4206,7 @@ void User_var_log_event::pack_info(Protocol* protocol) buf.length(0); if (!(cs= get_charset(charset_number, MYF(0)))) { - if (buf.append("???")) + if (buf.append(STRING_WITH_LEN("???"))) return; } else @@ -4212,9 +4214,9 @@ void User_var_log_event::pack_info(Protocol* protocol) size_t old_len; char *beg, *end; if (user_var_append_name_part(protocol->thd, &buf, name, name_len) || - buf.append("_") || - buf.append(cs->csname) || - buf.append(" ")) + buf.append('_') || + buf.append(cs->csname, strlen(cs->csname)) || + buf.append(' ')) return; old_len= buf.length(); if (buf.reserve(old_len + val_len * 2 + 3 + sizeof(" COLLATE ") + @@ -4223,8 +4225,8 @@ void User_var_log_event::pack_info(Protocol* protocol) beg= const_cast<char *>(buf.ptr()) + old_len; end= str_to_hex(beg, val, val_len); buf.length(old_len + (end - beg)); - if (buf.append(" COLLATE ") || - buf.append(cs->name)) + if (buf.append(STRING_WITH_LEN(" COLLATE ")) || + buf.append(cs->name, strlen(cs->name))) return; } protocol->store(buf.ptr(), buf.length(), &my_charset_bin); @@ -5028,7 +5030,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol) } if (query && q_len && buf.append(query, q_len)) return; - if (buf.append(" ;file_id=") || + if (buf.append(STRING_WITH_LEN(" ;file_id=")) || buf.append_ulonglong(file_id)) return; protocol->store(buf.ptr(), buf.length(), &my_charset_bin); |