diff options
author | unknown <holyfoot@deer.(none)> | 2006-06-19 22:11:01 +0500 |
---|---|---|
committer | unknown <holyfoot@deer.(none)> | 2006-06-19 22:11:01 +0500 |
commit | 8b6c2d312b51f10de453aca1ca2164e7432acf3c (patch) | |
tree | 20d968927ec70e5b39ffcb4c3320841f23309a5b /sql | |
parent | b10b25fbb59fb10527c207154bbb65270beddb84 (diff) | |
download | mariadb-git-8b6c2d312b51f10de453aca1ca2164e7432acf3c.tar.gz |
bug #20318 (ctype_ucs2_def test fails with embedded)
there was two problems about charsets in embedded server
1. mysys/charset.c - defined there default_charset_info variable is
modified by both server and client code (particularly when
--default-charset option is handled)
In embedded server we get two codelines modifying one variable.
I created separate default_client_charset_info for client code
2. mysql->charset and mysql->options.charset initialization isn't
properly done for embedded server - necessary calls added
include/sql_common.h:
client charset info default declared
libmysqld/lib_sql.cc:
thd_init_client_charset calls added
libmysqld/libmysqld.c:
check_embedded_connection moved to client.c to avoid code duplication
sql-common/client.c:
charset initialization moved to mysql_init_character_set to
be used in embedded server
sql/sql_parse.cc:
thread client charset initialization moved to thd_init_client_charset
to avoid code duplication
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_parse.cc | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 51ef3f31b26..4c0221c9e9c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -667,6 +667,37 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0) #endif /* NO_EMBEDDED_ACCESS_CHECKS */ } +void 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 || + !(thd->variables.character_set_client= get_charset(cs_number, MYF(0))) || + !my_strcasecmp(&my_charset_latin1, + global_system_variables.character_set_client->name, + thd->variables.character_set_client->name)) + { + thd->variables.character_set_client= + global_system_variables.character_set_client; + thd->variables.collation_connection= + global_system_variables.collation_connection; + thd->variables.character_set_results= + global_system_variables.character_set_results; + } + else + { + thd->variables.character_set_results= + thd->variables.collation_connection= + thd->variables.character_set_client; + } +} + + /* Perform handshake, authorize client and update thd ACL variables. SYNOPSIS @@ -809,33 +840,7 @@ static int check_connection(THD *thd) thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16; thd->max_client_packet_length= uint4korr(net->read_pos+4); DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8])); - /* - 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 || - !(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, - thd->variables.character_set_client->name)) - { - thd->variables.character_set_client= - global_system_variables.character_set_client; - thd->variables.collation_connection= - global_system_variables.collation_connection; - thd->variables.character_set_results= - global_system_variables.character_set_results; - } - else - { - thd->variables.character_set_results= - thd->variables.collation_connection= - thd->variables.character_set_client; - } + thd_init_client_charset(thd, (uint) net->read_pos[8]); thd->update_charset(); end= (char*) net->read_pos+32; } |