From f2ea1ac8b88136feabf103269ae63bc16f68bf37 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Wed, 31 Aug 2005 13:03:24 +0500 Subject: [PATCH] bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob sql_parse.cc: mysqld.cc: Added --skip-client-character-set-handshake. When this option is activated, client side character set (which is sent in handshake) is ignored, and server side default-character-set value is used for character_set_client and character_set_results, thus reprodicing 4.0 behaviour. --- sql/mysqld.cc | 7 +++++++ sql/sql_parse.cc | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 865f494bbc9..59b733b594c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -271,6 +271,7 @@ arg_cmp_func Arg_comparator::comparator_matrix[4][2] = bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; +bool opt_skip_character_set_client_handshake= 0; bool lower_case_table_names_used= 0; bool server_id_supplied = 0; bool opt_endinfo,using_udf_functions, locked_in_memory; @@ -4216,6 +4217,7 @@ enum options_mysqld OPT_EXPIRE_LOGS_DAYS, OPT_GROUP_CONCAT_MAX_LEN, OPT_DEFAULT_COLLATION, + OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_INIT_CONNECT, OPT_INIT_SLAVE, OPT_SECURE_AUTH, @@ -4753,6 +4755,11 @@ Can't be set to 1 if --log-slave-updates is used.", "Show user and password in SHOW SLAVE HOSTS on this master", (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, + "Don't use client side character set value sent during handshake.", + (gptr*) &opt_skip_character_set_client_handshake, + (gptr*) &opt_skip_character_set_client_handshake, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index caf76b19eb2..b8eae3aac74 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -811,11 +811,13 @@ static int check_connection(THD *thd) DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8])); /* Use server character set and collation if + - opt_skip_character_set_client_handshake is set - client has not specified a character set - client character set is the same as the servers - client character set doesn't exists in server */ - if (!(thd->variables.character_set_client= + if (opt_skip_character_set_client_handshake || + !(thd->variables.character_set_client= get_charset((uint) net->read_pos[8], MYF(0))) || !my_strcasecmp(&my_charset_latin1, global_system_variables.character_set_client->name,