Commit 061ed857 authored by aelkin@mysql.com's avatar aelkin@mysql.com

BUG#14157: utf8 encoding in binlog without set character_set_client: e.g DROP temporary

specific to 5.0 version of the patch is motivated by the fact that a wrapper over 
MYSQLLOG::write can not help in 5.0 where query's charset is embedded into event instance in the constructor.
parent 45d553a4
......@@ -1582,19 +1582,6 @@ inline int hexchar_to_int(char c)
return -1;
}
/*
wrapper to use instead of mysql_bin_log.write when
query is generated by the server using system_charset encoding
*/
inline void write_binlog_with_system_charset(THD * thd, Query_log_event * qinfo)
{
CHARSET_INFO * cs_save= thd->variables.character_set_client;
thd->variables.character_set_client= system_charset_info;
mysql_bin_log.write(qinfo);
thd->variables.character_set_client= cs_save;
}
/*
is_user_table()
return true if the table was created explicitly
......
......@@ -715,9 +715,12 @@ void close_temporary_tables(THD *thd)
close_temporary(table, 1);
}
thd->clear_error();
CHARSET_INFO *cs_save= thd->variables.character_set_client;
thd->variables.character_set_client= system_charset_info;
Query_log_event qinfo(thd, s_query.ptr(),
s_query.length() - 1 /* to remove trailing ',' */,
0, FALSE);
thd->variables.character_set_client= cs_save;
/*
Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as
......@@ -728,7 +731,7 @@ void close_temporary_tables(THD *thd)
rightfully causing the slave to stop.
*/
qinfo.error_code= 0;
write_binlog_with_system_charset(thd, &qinfo);
mysql_bin_log.write(&qinfo);
}
else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment