summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <holyfoot@mysql.com>2006-06-26 22:17:42 +0500
committerunknown <holyfoot@mysql.com>2006-06-26 22:17:42 +0500
commit31ffea2a08dee857f930936d4d0e38354065c16e (patch)
treeb25ab5ca3a95b5a7f90081d10120b5d4b60011bf /sql
parentfbed697d86101f83be235dda27aee310ba492b7b (diff)
parent8b6c2d312b51f10de453aca1ca2164e7432acf3c (diff)
downloadmariadb-git-31ffea2a08dee857f930936d4d0e38354065c16e.tar.gz
Merge mysql.com:/home/hf/work/mysql-4.1.20318
into mysql.com:/home/hf/work/mysql-4.1.clean sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc59
1 files changed, 32 insertions, 27 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 06005f31198..504339684ce 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;
}