diff options
author | Alexander Barkov <bar@mnogosearch.org> | 2013-11-08 20:59:08 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mnogosearch.org> | 2013-11-08 20:59:08 +0400 |
commit | e02ad98c63506c3260ac3a365e72886d7d02304a (patch) | |
tree | 88ff7149921c8f4e47d5a628bfdc8f4241ad8c06 /sql/item_timefunc.cc | |
parent | 7876d53b5f17e2c906f41d97e22514c1e36640bb (diff) | |
parent | d79d0c4045f5b93ded001ca6b963727b3362cd15 (diff) | |
download | mariadb-git-e02ad98c63506c3260ac3a365e72886d7d02304a.tar.gz |
Merge 5.5 -> 10.0-base
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f405aae4766..51d6d3fa6a6 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3096,13 +3096,25 @@ get_date_time_result_type(const char *format, uint length) void Item_func_str_to_date::fix_length_and_dec() { + if (agg_arg_charsets(collation, args, 2, MY_COLL_ALLOW_CONV, 1)) + return; + if (collation.collation->mbminlen > 1) + { +#if MYSQL_VERSION_ID > 50500 + internal_charset= &my_charset_utf8mb4_general_ci; +#else + internal_charset= &my_charset_utf8_general_ci; +#endif + } + cached_field_type= MYSQL_TYPE_DATETIME; decimals= NOT_FIXED_DEC; if ((const_item= args[1]->const_item())) { char format_buff[64]; String format_str(format_buff, sizeof(format_buff), &my_charset_bin); - String *format= args[1]->val_str(&format_str); + String *format= args[1]->val_str(&format_str, &format_converter, + internal_charset); decimals= 0; if (!args[1]->null_value) { @@ -3140,8 +3152,8 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format; - val= args[0]->val_str(&val_string); - format= args[1]->val_str(&format_str); + val= args[0]->val_str(&val_string, &subject_converter, internal_charset); + format= args[1]->val_str(&format_str, &format_converter, internal_charset); if (args[0]->null_value || args[1]->null_value) return (null_value=1); |