1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Make sure that warning message when GROUP_CONCAT() cuts values is also

updated with the correct number of lines. (Bug #8681)
This commit is contained in:
jimw@mysql.com
2005-02-23 17:58:20 -08:00
parent a50be4d42b
commit 624f855e94
3 changed files with 45 additions and 8 deletions

View File

@@ -1787,16 +1787,26 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
void Item_func_group_concat::cleanup()
{
THD *thd= current_thd;
DBUG_ENTER("Item_func_group_concat::cleanup");
Item_sum::cleanup();
/* Adjust warning message to include total number of cut values */
if (warning)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
warning->set_msg(thd, warn_buff);
warning= 0;
}
/*
Free table and tree if they belong to this item (if item have not pointer
to original item from which was made copy => it own its objects )
*/
if (!original)
{
THD *thd= current_thd;
if (table)
{
free_tmp_table(thd, table);
@@ -1809,13 +1819,6 @@ void Item_func_group_concat::cleanup()
tree_mode= 0;
delete_tree(tree);
}
if (warning)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
warning->set_msg(thd, warn_buff);
warning= 0;
}
}
DBUG_VOID_RETURN;
}
@@ -2076,6 +2079,10 @@ String* Item_func_group_concat::val_str(String* str)
if (null_value)
return 0;
if (count_cut_values && !warning)
/*
ER_CUT_VALUE_GROUP_CONCAT needs an argument, but this gets set in
Item_func_group_concat::cleanup().
*/
warning= push_warning(item_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CUT_VALUE_GROUP_CONCAT,
ER(ER_CUT_VALUE_GROUP_CONCAT));