summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-10-17 14:28:00 +0500
committerramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-10-17 14:28:00 +0500
commitffde32d219d7824257efc98476c310bf3ffac06b (patch)
treeb4d51f696fcdcd2fce29e52fdd1d55198ca848e4 /sql/set_var.cc
parent18250925bcad309e8dd5424ba40205be60cdbf59 (diff)
downloadmariadb-git-ffde32d219d7824257efc98476c310bf3ffac06b.tar.gz
Fix for bug#31615: crash after set names ucs2 collate xxx
Problem: currently, UCS-2 cannot be used as a client character set. Fix: raise an error if one attempts to set it to USC-2.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 520ee5c9f70..275252c4960 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1992,6 +1992,21 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
}
+bool sys_var_character_set_client::check(THD *thd, set_var *var)
+{
+ if (sys_var_character_set::check(thd, var))
+ return 1;
+ /* Currently, UCS-2 cannot be used as a client character set */
+ if (var->save_result.charset->mbminlen > 1)
+ {
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name,
+ var->save_result.charset->csname);
+ return 1;
+ }
+ return 0;
+}
+
+
CHARSET_INFO **
sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
{
@@ -2355,6 +2370,13 @@ end:
int set_var_collation_client::check(THD *thd)
{
+ /* Currently, UCS-2 cannot be used as a client character set */
+ if (character_set_client->mbminlen > 1)
+ {
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
+ character_set_client->csname);
+ return 1;
+ }
return 0;
}