diff options
author | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-12-05 14:08:19 +0400 |
---|---|---|
committer | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-12-05 14:08:19 +0400 |
commit | 3eafe5cf98b0fc2a1e58305578829799d28d482c (patch) | |
tree | dd0cd34a72ea20f211dbbf68eace37e323285c7f /sql/set_var.cc | |
parent | d553728bfbf4ea4cbdf0532326c4873f4cdcae78 (diff) | |
parent | 4474cc8493fb999b1fea4da739177c146909ddef (diff) | |
download | mariadb-git-3eafe5cf98b0fc2a1e58305578829799d28d482c.tar.gz |
Merge mysql.com:/usr/home/bar/mysql-4.1.b22645
into mysql.com:/usr/home/bar/mysql-5.0.b22645
mysql-test/r/variables.result:
Auto merged
mysql-test/t/variables.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/log.cc:
Removing one_shot from 5.0.
sql/sql_locale.cc:
After merge fix
sql/set_var.cc:
After merge fix
sql/set_var.h:
After merge fix
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 55c62a9a5a5..0978a84d403 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2782,17 +2782,39 @@ byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, return (byte*) &(max_user_connections); } + bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) { - char *locale_str =var->value->str_value.c_ptr(); - MY_LOCALE *locale_match= my_locale_by_name(locale_str); + MY_LOCALE *locale_match; - if (locale_match == NULL) + if (var->value->result_type() == INT_RESULT) { - my_printf_error(ER_UNKNOWN_ERROR, - "Unknown locale: '%s'", MYF(0), locale_str); - return 1; + if (!(locale_match= my_locale_by_number((uint) var->value->val_int()))) + { + char buf[20]; + int10_to_str((int) var->value->val_int(), buf, -10); + my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), buf); + return 1; + } + } + else // STRING_RESULT + { + char buff[6]; + String str(buff, sizeof(buff), &my_charset_latin1), *res; + if (!(res=var->value->val_str(&str))) + { + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); + return 1; + } + const char *locale_str= res->c_ptr(); + if (!(locale_match= my_locale_by_name(locale_str))) + { + my_printf_error(ER_UNKNOWN_ERROR, + "Unknown locale: '%s'", MYF(0), locale_str); + return 1; + } } + var->save_result.locale_value= locale_match; return 0; } |