MDEV-6805 one can set character_set_client to utf32

use the same restriction for character_set_client on the command line
and from SQL.

Also: remove strange hack from thd_init_client_charset() that contradicted
the manual (collation_connection and character_set_result were not always set)
This commit is contained in:
Sergei Golubchik 2014-11-18 22:25:47 +01:00
parent a8bd285f7c
commit ea04a8cfda
11 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
show variables like 'collation_server';
Variable_name Value
collation_server ucs2_unicode_ci

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
#
# Start of 5.5 tests
#

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Cannot use utf16 as character_set_client");
SHOW VARIABLES LIKE 'collation_server';
Variable_name Value
collation_server utf16_general_ci

View File

@ -11,7 +11,7 @@ SELECT @@global.character_set_connection;
utf8
SELECT @@session.character_set_connection;
@@session.character_set_connection
utf8
latin1
'#--------------------FN_DYNVARS_011_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;

View File

@ -9,7 +9,7 @@ SELECT @@global.character_set_results;
utf8
SELECT @@session.character_set_results;
@@session.character_set_results
utf8
latin1
'#--------------------FN_DYNVARS_012_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;

View File

@ -9,7 +9,7 @@ SELECT @@global.collation_connection;
latin1_danish_ci
SELECT @@session.collation_connection;
@@session.collation_connection
latin1_danish_ci
latin1_swedish_ci
'#--------------------FN_DYNVARS_015_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;

View File

@ -1,5 +1,7 @@
-- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
#
# MySQL Bug#15276: MySQL ignores collation-server
#

View File

@ -1,6 +1,8 @@
-- source include/have_query_cache.inc
-- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
--echo #
--echo # Start of 5.5 tests
--echo #

View File

@ -1,4 +1,5 @@
--source include/have_utf16.inc
call mtr.add_suppression("Cannot use utf16 as character_set_client");
#
# Bug #32391 Character sets: crash with --character-set-server

View File

@ -4268,7 +4268,15 @@ static int init_common_variables()
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
if (default_charset_info->mbminlen > 1)
{
global_system_variables.character_set_client= &my_charset_latin1;
sql_print_warning("Cannot use %s as character_set_client, %s will be used instead",
default_charset_info->csname,
global_system_variables.character_set_client->csname);
}
else
global_system_variables.character_set_client= default_charset_info;
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,

View File

@ -837,14 +837,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
Use server character set and collation if
- opt_character_set_client_handshake is not 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 (!opt_character_set_client_handshake ||
!(cs= get_charset(cs_number, MYF(0))) ||
!my_strcasecmp(&my_charset_latin1,
global_system_variables.character_set_client->name,
cs->name))
!(cs= get_charset(cs_number, MYF(0))))
{
thd->variables.character_set_client=
global_system_variables.character_set_client;