summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-11-08 17:03:37 +0400
committerunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-11-08 17:03:37 +0400
commit6bae01057c58190eba25a4ca93ae6caa4584872b (patch)
treea83b58c504c421ce6a211bf25b9966c33e95f8fd /sql/item_sum.cc
parentc6de4d1c3baa5a27dd6f4ba2dd58c85e627b6536 (diff)
parentd9360eae3b57c7ef4b1a14b270d06c8423df3bfb (diff)
downloadmariadb-git-6bae01057c58190eba25a4ca93ae6caa4584872b.tar.gz
Merge mysql.com:/usr/home/bar/mysql-4.1.b23451v2
into mysql.com:/usr/home/bar/mysql-5.0.b23451 mysql-test/r/func_gconcat.result: after merge fix mysql-test/t/func_gconcat.test: after merge fix sql/item_sum.cc: after merge fix
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 77c6e17607f..000a8ce4b10 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3001,6 +3001,7 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
String tmp2;
String *result= &item->result;
Item **arg= item->args, **arg_end= item->args + item->arg_count_field;
+ uint old_length= result->length();
if (item->no_appended)
item->no_appended= FALSE;
@@ -3035,8 +3036,22 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
/* stop if length of result more than max_length */
if (result->length() > item->max_length)
{
+ int well_formed_error;
+ CHARSET_INFO *cs= item->collation.collation;
+ const char *ptr= item->result.ptr();
+ uint add_length;
+ /*
+ It's ok to use item->result.length() as the fourth argument
+ as this is never used to limit the length of the data.
+ Cut is done with the third argument.
+ */
+ add_length= cs->cset->well_formed_len(cs,
+ ptr + old_length,
+ ptr + item->group_concat_max_len,
+ item->result.length(),
+ &well_formed_error);
+ item->result.length(old_length + add_length);
item->count_cut_values++;
- result->length(item->max_length);
item->warning_for_row= TRUE;
return 1;
}
@@ -3226,8 +3241,7 @@ bool Item_func_group_concat::add()
we can dump the row here in case of GROUP_CONCAT(DISTINCT...)
instead of doing tree traverse later.
*/
- if (result.length() <= max_length &&
- !warning_for_row &&
+ if (!warning_for_row &&
(!tree || (el->count == 1 && distinct && !arg_count_order)))
dump_leaf_key(table->record[0] + table->s->null_bytes, 1, this);