diff options
author | unknown <bar@mysql.com/bar.myoffice.izhnet.ru> | 2007-06-22 17:18:40 +0500 |
---|---|---|
committer | unknown <bar@mysql.com/bar.myoffice.izhnet.ru> | 2007-06-22 17:18:40 +0500 |
commit | 46c3d7b87d27c1e2a2507b1faa7a1ee26d74715b (patch) | |
tree | ee613ba26d3ba97630da4fa77ddd4fafd575a6c2 /sql/item_sum.cc | |
parent | 3babaecc412e3239d4c7bf4102a40fa6dbdaf335 (diff) | |
download | mariadb-git-46c3d7b87d27c1e2a2507b1faa7a1ee26d74715b.tar.gz |
Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
Problem: separator was not converted to the result character set,
so the result was a mixture of two different character sets,
which was especially bad for UCS2.
Fix: convert separator to the result character set.
mysql-test/r/ctype_ucs.result:
Adding test case
mysql-test/r/ctype_ucs2_def.result:
Adding test case
mysql-test/t/ctype_ucs.test:
Adding test case
mysql-test/t/ctype_ucs2_def.test:
Adding test case
sql/item_sum.cc:
Adding conversion of separator to the result character set
sql/sql_yacc.yy:
Fixing GROUPC_CONCAT problems when "mysqld --default-character-set=ucs2".
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ea2a14ffb63..be1946b4677 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3209,6 +3209,27 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) null_value= 1; max_length= thd->variables.group_concat_max_len; + uint32 offset; + if (separator->needs_conversion(separator->length(), separator->charset(), + collation.collation, &offset)) + { + uint32 buflen= collation.collation->mbmaxlen * separator->length(); + uint errors, conv_length; + char *buf; + String *new_separator; + + if (!(buf= thd->stmt_arena->alloc(buflen)) || + !(new_separator= new(thd->stmt_arena->mem_root) + String(buf, buflen, collation.collation))) + return TRUE; + + conv_length= copy_and_convert(buf, buflen, collation.collation, + separator->ptr(), separator->length(), + separator->charset(), &errors); + new_separator->length(conv_length); + separator= new_separator; + } + if (check_sum_func(thd, ref)) return TRUE; |