mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
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
This commit is contained in:
@@ -550,7 +550,7 @@ static void handle_bootstrap_impl(THD *thd)
|
||||
query= (char *) thd->memdup_w_gap(buff, length + 1,
|
||||
thd->db_length + 1 +
|
||||
QUERY_CACHE_FLAGS_SIZE);
|
||||
thd->set_query_and_id(query, length, next_query_id());
|
||||
thd->set_query_and_id(query, length, thd->charset(), next_query_id());
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query()));
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.start_new_query();
|
||||
@@ -1065,7 +1065,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->security_ctx->priv_user,
|
||||
(char *) thd->security_ctx->host_or_ip);
|
||||
|
||||
thd->set_query_and_id(beginning_of_next_stmt, length, next_query_id());
|
||||
thd->set_query_and_id(beginning_of_next_stmt, length,
|
||||
thd->charset(), next_query_id());
|
||||
/*
|
||||
Count each statement from the client.
|
||||
*/
|
||||
@@ -1390,7 +1391,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
log_slow_statement(thd);
|
||||
|
||||
thd_proc_info(thd, "cleaning up");
|
||||
thd->set_query(NULL, 0);
|
||||
thd->reset_query();
|
||||
thd->command=COM_SLEEP;
|
||||
dec_thread_running();
|
||||
thd_proc_info(thd, 0);
|
||||
@@ -5494,7 +5495,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
if (found_semicolon && (ulong) (found_semicolon - thd->query()))
|
||||
thd->set_query_inner(thd->query(),
|
||||
(uint32) (found_semicolon -
|
||||
thd->query() - 1));
|
||||
thd->query() - 1),
|
||||
thd->charset());
|
||||
/* Actually execute the query */
|
||||
if (found_semicolon)
|
||||
{
|
||||
|
Reference in New Issue
Block a user