Commit ea04a8cf authored by Sergei Golubchik's avatar Sergei Golubchik

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)
parent a8bd285f
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
show variables like 'collation_server'; show variables like 'collation_server';
Variable_name Value Variable_name Value
collation_server ucs2_unicode_ci collation_server ucs2_unicode_ci
......
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
# #
# Start of 5.5 tests # Start of 5.5 tests
# #
......
call mtr.add_suppression("Cannot use utf16 as character_set_client");
SHOW VARIABLES LIKE 'collation_server'; SHOW VARIABLES LIKE 'collation_server';
Variable_name Value Variable_name Value
collation_server utf16_general_ci collation_server utf16_general_ci
......
...@@ -11,7 +11,7 @@ SELECT @@global.character_set_connection; ...@@ -11,7 +11,7 @@ SELECT @@global.character_set_connection;
utf8 utf8
SELECT @@session.character_set_connection; SELECT @@session.character_set_connection;
@@session.character_set_connection @@session.character_set_connection
utf8 latin1
'#--------------------FN_DYNVARS_011_02-------------------------#' '#--------------------FN_DYNVARS_011_02-------------------------#'
'connection default' 'connection default'
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
......
...@@ -9,7 +9,7 @@ SELECT @@global.character_set_results; ...@@ -9,7 +9,7 @@ SELECT @@global.character_set_results;
utf8 utf8
SELECT @@session.character_set_results; SELECT @@session.character_set_results;
@@session.character_set_results @@session.character_set_results
utf8 latin1
'#--------------------FN_DYNVARS_012_02-------------------------#' '#--------------------FN_DYNVARS_012_02-------------------------#'
'connection default' 'connection default'
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
......
...@@ -9,7 +9,7 @@ SELECT @@global.collation_connection; ...@@ -9,7 +9,7 @@ SELECT @@global.collation_connection;
latin1_danish_ci latin1_danish_ci
SELECT @@session.collation_connection; SELECT @@session.collation_connection;
@@session.collation_connection @@session.collation_connection
latin1_danish_ci latin1_swedish_ci
'#--------------------FN_DYNVARS_015_02-------------------------#' '#--------------------FN_DYNVARS_015_02-------------------------#'
'connection default' 'connection default'
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
......
-- source include/have_ucs2.inc -- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
# #
# MySQL Bug#15276: MySQL ignores collation-server # MySQL Bug#15276: MySQL ignores collation-server
# #
......
-- source include/have_query_cache.inc -- source include/have_query_cache.inc
-- source include/have_ucs2.inc -- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
--echo # --echo #
--echo # Start of 5.5 tests --echo # Start of 5.5 tests
--echo # --echo #
......
--source include/have_utf16.inc --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 # Bug #32391 Character sets: crash with --character-set-server
......
...@@ -4268,6 +4268,14 @@ static int init_common_variables() ...@@ -4268,6 +4268,14 @@ static int init_common_variables()
global_system_variables.collation_database= default_charset_info; global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= 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_results= 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; global_system_variables.character_set_client= default_charset_info;
if (!(character_set_filesystem= if (!(character_set_filesystem=
......
...@@ -837,14 +837,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number) ...@@ -837,14 +837,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
Use server character set and collation if Use server character set and collation if
- opt_character_set_client_handshake is not set - opt_character_set_client_handshake is not set
- client has not specified a character 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 - client character set doesn't exists in server
*/ */
if (!opt_character_set_client_handshake || if (!opt_character_set_client_handshake ||
!(cs= get_charset(cs_number, MYF(0))) || !(cs= get_charset(cs_number, MYF(0))))
!my_strcasecmp(&my_charset_latin1,
global_system_variables.character_set_client->name,
cs->name))
{ {
thd->variables.character_set_client= thd->variables.character_set_client=
global_system_variables.character_set_client; global_system_variables.character_set_client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment