summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-12-11 19:40:58 +0300
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-12-11 19:40:58 +0300
commitebdef570e552b93b693398f42c229cf77ab85965 (patch)
treead3ff84791c35c7d8b2d47a60f0ea4cb409a0a31 /sql/item_timefunc.cc
parent567671368723c704d60902b4d0ccff951b414552 (diff)
parent684c7aba09583e54c5272cc3b0eec207afc87a39 (diff)
downloadmariadb-git-ebdef570e552b93b693398f42c229cf77ab85965.tar.gz
Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 8208b0b930d..1702868aeb8 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2608,9 +2608,9 @@ void Item_char_typecast::fix_length_and_dec()
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 / args[0]->collation.collation->mbmaxlen;
+ char_length= (cast_length >= 0) ? cast_length :
+ args[0]->max_length /
+ (cast_cs == &my_charset_bin ? 1 : args[0]->collation.collation->mbmaxlen);
max_length= char_length * cast_cs->mbmaxlen;
}