summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-22 11:13:07 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-22 12:49:37 +0100
commite7d7910b7a926ccc6f5b8d73d55ac511f1c03c3d (patch)
treec9d77ef4b1577cef28f9b852f1d05fa22b9df448
parent48655ce6985490fdf6c5c8be7c75b37f83f7738e (diff)
downloadmariadb-git-e7d7910b7a926ccc6f5b8d73d55ac511f1c03c3d.tar.gz
add an assert
and use is_supported_parser_charset() instead of direct check
-rw-r--r--sql/sql_connect.cc16
-rw-r--r--sql/sys_vars.cc3
2 files changed, 9 insertions, 10 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 61f8b4081eb..e2e56c48b3b 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2007, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+ Copyright (c) 2008, 2016, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -821,6 +821,7 @@ void update_global_user_stats(THD *thd, bool create_user, time_t now)
bool thd_init_client_charset(THD *thd, uint cs_number)
{
+ SV *gv=&global_system_variables;
CHARSET_INFO *cs;
/*
Use server character set and collation if
@@ -831,16 +832,13 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
*/
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,
+ !my_strcasecmp(&my_charset_latin1, gv->character_set_client->name,
cs->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;
+ DBUG_ASSERT(is_supported_parser_charset(gv->character_set_client));
+ thd->variables.character_set_client= gv->character_set_client;
+ thd->variables.collation_connection= gv->collation_connection;
+ thd->variables.character_set_results= gv->character_set_results;
}
else
{
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 7b898906184..35997525456 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -31,6 +31,7 @@
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_class.h" // set_var.h: THD
+#include "sql_parse.h"
#include "sys_vars.h"
#include "events.h"
@@ -445,7 +446,7 @@ static bool check_cs_client(sys_var *self, THD *thd, set_var *var)
return true;
// Currently, UCS-2 cannot be used as a client character set
- if (((CHARSET_INFO *)(var->save_result.ptr))->mbminlen > 1)
+ if (!is_supported_parser_charset((CHARSET_INFO *)(var->save_result.ptr)))
return true;
return false;