Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2091 06/02/03 13:05:14 petr@stripped +4 -0
Fix for Bug#16905 Log tables: unicode statements are logged incorrectly
sql/log.h
1.5 06/02/03 13:05:10 petr@stripped +6 -3
pass the charset info along with the log messages
to log them correctly
sql/log.cc
1.190 06/02/03 13:05:10 petr@stripped +13 -10
take into account client charset info, while logging
into a table.
mysql-test/t/log_tables.test
1.4 06/02/03 13:05:10 petr@stripped +18 -0
add a testcase
mysql-test/r/log_tables.result
1.2 06/02/03 13:05:10 petr@stripped +12 -0
update result
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: petr
# Host: outpost.site
# Root: /home/cps/mysql/devel/5.1-utf-bug
--- 1.189/sql/log.cc 2006-01-27 16:10:37 +03:00
+++ 1.190/sql/log.cc 2006-02-03 13:05:10 +03:00
@@ -310,7 +310,8 @@
log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)
{
TABLE *table= general_log.table;
@@ -325,11 +326,11 @@
/* set default value (which is CURRENT_TIMESTAMP) */
table->field[0]->set_null();
- table->field[1]->store(user_host, user_host_len, &my_charset_latin1);
+ table->field[1]->store(user_host, user_host_len, client_cs);
table->field[2]->store((longlong) thread_id);
table->field[3]->store((longlong) server_id);
- table->field[4]->store(command_type, command_type_len, &my_charset_latin1);
- table->field[5]->store(sql_text, sql_text_len, &my_charset_latin1);
+ table->field[4]->store(command_type, command_type_len, client_cs);
+ table->field[5]->store(sql_text, sql_text_len, client_cs);
table->file->ha_write_row(table->record[0]);
reenable_binlog(current_thd);
@@ -375,6 +376,7 @@
{
/* table variables */
TABLE *table= slow_log.table;
+ CHARSET_INFO *client_cs= thd->variables.character_set_client;
DBUG_ENTER("log_slow_to_csv");
@@ -395,7 +397,7 @@
table->field[0]->set_null();
/* store the value */
- table->field[1]->store(user_host, user_host_len, &my_charset_latin1);
+ table->field[1]->store(user_host, user_host_len, client_cs);
if (query_start_arg)
{
@@ -418,7 +420,7 @@
if (thd->db)
/* fill database field */
- table->field[6]->store(thd->db, thd->db_length, &my_charset_latin1);
+ table->field[6]->store(thd->db, thd->db_length, client_cs);
else
table->field[6]->set_null();
@@ -436,8 +438,7 @@
table->field[9]->store((longlong) server_id);
/* sql_text */
- table->field[10]->store(sql_text,sql_text_len,
- &my_charset_latin1);
+ table->field[10]->store(sql_text,sql_text_len, client_cs);
/* write the row */
table->file->ha_write_row(table->record[0]);
@@ -493,7 +494,8 @@
log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)
{
return mysql_log.write(event_time, user_host, user_host_len,
thread_id, command_type, command_type_len,
@@ -809,7 +811,8 @@
user_host_len, id,
command_name[(uint) command].str,
command_name[(uint) command].length,
- message_buff, message_buff_len) || error;
+ message_buff, message_buff_len,
+ thd->variables.character_set_client) || error;
unlock();
}
return error;
--- 1.1/mysql-test/r/log_tables.result 2006-01-19 05:56:01 +03:00
+++ 1.2/mysql-test/r/log_tables.result 2006-02-03 13:05:10 +03:00
@@ -52,3 +52,15 @@
as "test passed";
test passed
Mark that we woke up from TRUNCATE in the test
+use test;
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP root[root] @ localhost [] 2 1 Query set names utf8
+TIMESTAMP root[root] @ localhost [] 2 1 Query create table bug16905 (s char(15) character
set utf8 default 'пусто')
+TIMESTAMP root[root] @ localhost [] 2 1 Query insert into bug16905 values ('новое')
+TIMESTAMP root[root] @ localhost [] 2 1 Query select * from mysql.general_log
+drop table bug16905;
--- 1.3/mysql-test/t/log_tables.test 2006-01-23 17:28:33 +03:00
+++ 1.4/mysql-test/t/log_tables.test 2006-02-03 13:05:10 +03:00
@@ -144,7 +144,25 @@
select "Mark that we woke up from TRUNCATE in the test"
as "test passed";
+connection con1;
+
disconnect con2;
+
+use test;
+
+#
+# Bug #16905 Log tables: unicode statements are logged incorrectly
+#
+
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+--replace_column 1 TIMESTAMP
+select * from mysql.general_log;
+drop table bug16905;
+
+
disconnect con1;
--enable_ps_protocol
--- 1.4/sql/log.h 2006-01-30 02:24:44 +03:00
+++ 1.5/sql/log.h 2006-02-03 13:05:10 +03:00
@@ -368,7 +368,8 @@
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)= 0;
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)= 0;
virtual ~Log_event_handler() {}
};
@@ -403,7 +404,8 @@
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len);
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs);
bool flush(THD *thd, TABLE_LIST *close_slow_Log,
TABLE_LIST* close_general_log);
void close_log_table(uint log_type, bool lock_in_use);
@@ -431,7 +433,8 @@
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len);
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs);
void flush();
void init_pthread_objects();
};
| Thread |
|---|
| • bk commit into 5.1 tree (petr:1.2091) BUG#16905 | Petr Chardin | 3 Feb |