diff options
author | Alexander Barkov <bar@mysql.com> | 2010-11-18 17:08:32 +0300 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2010-11-18 17:08:32 +0300 |
commit | 185e189da36bb0f5c71c2766fd1aff771a8d96a3 (patch) | |
tree | fcd3a65d0caa8675faa529c049100b091cf64214 /storage | |
parent | c8353d51aebb5c04e8aaaef9b73003dabb72a2aa (diff) | |
download | mariadb-git-185e189da36bb0f5c71c2766fd1aff771a8d96a3.tar.gz |
Bug#57306 SHOW PROCESSLIST does not display string literals well.
Problem: Extended characters outside of ASCII range where not displayed
properly in SHOW PROCESSLIST, because thd_info->query was always sent as
system_character_set (utf8). This was wrong, because query buffer
is never converted to utf8 - it is always have client character set.
Fix: sending query buffer using query character set
@ sql/sql_class.cc
@ sql/sql_class.h
Introducing a new class CSET_STRING, a LEX_STRING with character set.
Adding set_query(&CSET_STRING)
Adding reset_query(), to use instead of set_query(0, NULL).
@ sql/event_data_objects.cc
Using reset_query()
@ sql/log_event.cc
Using reset_query()
Adding charset argument to set_query_and_id().
@ sql/slave.cc
Using reset_query().
@ sql/sp_head.cc
Changing backing up and restore code to use CSET_STRING.
@ sql/sql_audit.h
Using CSET_STRING.
In the "else" branch it's OK not to use
global_system_variables.character_set_client.
&my_charset_latin1, which is set in constructor, is fine
(verified with Sergey Vojtovich).
@ sql/sql_insert.cc
Using set_query() with proper character set: table_name is utf8.
@ sql/sql_parse.cc
Adding character set argument to set_query_and_id().
(This is the main point where thd->charset() is stored
into thd->query_string.cs, for use in "SHOW PROCESSLIST".)
Using reset_query().
@ sql/sql_prepare.cc
Storing client character set into thd->query_string.cs.
@ sql/sql_show.cc
Using CSET_STRING to fetch and send charset-aware query information
from threads.
@ storage/myisam/ha_myisam.cc
Using set_query() with proper character set: table_name is utf8.
@ mysql-test/r/show_check.result
@ mysql-test/t/show_check.test
Adding tests
Diffstat (limited to 'storage')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2ba62d03c6b..c4bb6d7dbd4 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1499,8 +1499,6 @@ bool ha_myisam::check_and_repair(THD *thd) { int error=0; int marked_crashed; - char *old_query; - uint old_query_length; HA_CHECK_OPT check_opt; DBUG_ENTER("ha_myisam::check_and_repair"); @@ -1511,10 +1509,9 @@ bool ha_myisam::check_and_repair(THD *thd) check_opt.flags|=T_QUICK; sql_print_warning("Checking table: '%s'",table->s->path.str); - old_query= thd->query(); - old_query_length= thd->query_length(); + const CSET_STRING query_backup= thd->query_string; thd->set_query(table->s->table_name.str, - (uint) table->s->table_name.length); + (uint) table->s->table_name.length, system_charset_info); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) { @@ -1527,7 +1524,7 @@ bool ha_myisam::check_and_repair(THD *thd) if (repair(thd, &check_opt)) error=1; } - thd->set_query(old_query, old_query_length); + thd->set_query(query_backup); DBUG_RETURN(error); } |