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
This commit is contained in:
unknown 2006-11-08 17:03:37 +04:00
commit 6bae01057c
3 changed files with 122 additions and 3 deletions

View file

@ -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);