summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-06-30 02:09:50 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-06-30 02:09:50 +0500
commitdb397d16ad3d6e18971e11fb7d5f3245d4e28928 (patch)
tree57636873a49792d17dc92d392f6e35dd12cb6151 /sql/item.cc
parentb728d0a65e8df91c9225d59e3af2cffe1e9f4257 (diff)
downloadmariadb-git-db397d16ad3d6e18971e11fb7d5f3245d4e28928.tar.gz
Fixed bug #29205.
When a UNION statement forced conversion of an UTF8 charset value to a binary charset value, the byte length of the result values was truncated to the CHAR_LENGTH of the original UTF8 value. sql/item.cc: Fixed bug #29205. The calculation of data length was modified in the Item_type_holder::join_types method to take into account possible conversion of a multibyte charset value to a binary charset value, when each multibyte character is converted into a sequence of bytes (not to a single byte of binary charset). mysql-test/t/ctype_utf8.test: Updated test case for bug #29205. mysql-test/r/ctype_utf8.result: Updated test case for bug #29205.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index a334028fd64..52389eece10 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6595,9 +6595,15 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
expansion of the size of the values because of character set
conversions.
*/
- max_length= max(old_max_chars * collation.collation->mbmaxlen,
- display_length(item) / item->collation.collation->mbmaxlen *
- collation.collation->mbmaxlen);
+ if (collation.collation != &my_charset_bin)
+ {
+ max_length= max(old_max_chars * collation.collation->mbmaxlen,
+ display_length(item) /
+ item->collation.collation->mbmaxlen *
+ collation.collation->mbmaxlen);
+ }
+ else
+ set_if_bigger(max_length, display_length(item));
break;
}
case REAL_RESULT: