summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2008-11-21 17:32:45 +0400
committerRamil Kalimullin <ramil@mysql.com>2008-11-21 17:32:45 +0400
commit5a8fd4a3ce0f6194284b1123a36b5d7a986a015b (patch)
treebe71f06c4bf78be24dab0ba14146d6eb7bc60b96 /sql/item_timefunc.cc
parent30b795dfcbc068f2b1e9e73c76490605e00f63f9 (diff)
parentca31fa3591ff260ddf4dbd6fdb026eb9cd3972b5 (diff)
downloadmariadb-git-5a8fd4a3ce0f6194284b1123a36b5d7a986a015b.tar.gz
Auto-merge
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 390f94945aa..843a48ae118 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec()
and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to
the argument's charset.
+
+ Note (TODO): we could use repertoire technique here.
*/
from_cs= (args[0]->result_type() == INT_RESULT ||
args[0]->result_type() == DECIMAL_RESULT ||
@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec()
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
args[0]->collation.collation;
charset_conversion= (cast_cs->mbmaxlen > 1) ||
- !my_charset_same(from_cs, cast_cs) &&
- from_cs != &my_charset_bin &&
- cast_cs != &my_charset_bin;
+ (!my_charset_same(from_cs, cast_cs) &&
+ from_cs != &my_charset_bin &&
+ cast_cs != &my_charset_bin);
collation.set(cast_cs, DERIVATION_IMPLICIT);
- char_length= (cast_length >= 0) ? cast_length :
- args[0]->max_length/from_cs->mbmaxlen;
+ char_length= (cast_length >= 0) ?
+ cast_length :
+ args[0]->max_length / args[0]->collation.collation->mbmaxlen;
max_length= char_length * cast_cs->mbmaxlen;
}