summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <df@pippilotta.erinye.com>2007-12-10 10:41:34 +0100
committerunknown <df@pippilotta.erinye.com>2007-12-10 10:41:34 +0100
commit069ca6d0f7c7e73acf2bfd185027eba4c8589a9d (patch)
tree3e177ac5739c19247af8dd6a9da50fd8509e995c /sql
parentd09dfdab06ec473debd5c4ce4bb4f9c5eec5c4d9 (diff)
parent18d14b3a85dfcadacb5a8e33ead4bc8d5bf29d95 (diff)
downloadmariadb-git-069ca6d0f7c7e73acf2bfd185027eba4c8589a9d.tar.gz
Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-4.1
into pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-4.1-build
Diffstat (limited to 'sql')
-rw-r--r--sql/item_timefunc.cc49
-rw-r--r--sql/set_var.cc22
-rw-r--r--sql/set_var.h1
3 files changed, 49 insertions, 23 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 4bd3d68b9c1..08e0a727544 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2958,39 +2958,42 @@ Field *Item_func_str_to_date::tmp_table_field(TABLE *t_arg)
void Item_func_str_to_date::fix_length_and_dec()
{
- char format_buff[64];
- String format_str(format_buff, sizeof(format_buff), &my_charset_bin);
- String *format;
maybe_null= 1;
decimals=0;
cached_field_type= MYSQL_TYPE_STRING;
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
- format= args[1]->val_str(&format_str);
- if (!args[1]->null_value && (const_item= args[1]->const_item()))
+ if ((const_item= args[1]->const_item()))
{
- cached_format_type= get_date_time_result_type(format->ptr(),
- format->length());
- switch (cached_format_type) {
- case DATE_ONLY:
- cached_timestamp_type= MYSQL_TIMESTAMP_DATE;
- cached_field_type= MYSQL_TYPE_DATE;
- max_length= MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
- break;
- case TIME_ONLY:
- case TIME_MICROSECOND:
- cached_timestamp_type= MYSQL_TIMESTAMP_TIME;
- cached_field_type= MYSQL_TYPE_TIME;
- max_length= MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
- break;
- default:
- cached_timestamp_type= MYSQL_TIMESTAMP_DATETIME;
- cached_field_type= MYSQL_TYPE_DATETIME;
- break;
+ char format_buff[64];
+ String format_str(format_buff, sizeof(format_buff), &my_charset_bin);
+ String *format= args[1]->val_str(&format_str);
+ if (!args[1]->null_value)
+ {
+ cached_format_type= get_date_time_result_type(format->ptr(),
+ format->length());
+ switch (cached_format_type) {
+ case DATE_ONLY:
+ cached_timestamp_type= MYSQL_TIMESTAMP_DATE;
+ cached_field_type= MYSQL_TYPE_DATE;
+ max_length= MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN;
+ break;
+ case TIME_ONLY:
+ case TIME_MICROSECOND:
+ cached_timestamp_type= MYSQL_TIMESTAMP_TIME;
+ cached_field_type= MYSQL_TYPE_TIME;
+ max_length= MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN;
+ break;
+ default:
+ cached_timestamp_type= MYSQL_TIMESTAMP_DATETIME;
+ cached_field_type= MYSQL_TYPE_DATETIME;
+ break;
+ }
}
}
}
+
bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
{
DATE_TIME_FORMAT date_time_format;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 1d18eba30a8..25af4cf5c9e 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;
}
diff --git a/sql/set_var.h b/sql/set_var.h
index 78b34963e9d..f6fd0a082b5 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -578,6 +578,7 @@ public:
sys_var_character_set(name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
+ bool check(THD *thd, set_var *var);
};
class sys_var_character_set_results :public sys_var_character_set