Commit 02b810d2 authored by unknown's avatar unknown

BUG#4315

BUG#4535
BUG#4686


sql/item_sum.cc:
  Changed code of fix_fields
  Fixed wrong order of parameters in create_tmp_table
  Changed value set_sum_field in create_tmp_table
parent 4d3c575a
...@@ -1966,10 +1966,11 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) ...@@ -1966,10 +1966,11 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Fix fields for select list and ORDER clause Fix fields for select list and ORDER clause
*/ */
for (uint i=0 ; i < arg_count ; i++) for (i=0 ; i < arg_count ; i++)
{ {
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1; return 1;
if (i < arg_count_field)
maybe_null |= args[i]->maybe_null; maybe_null |= args[i]->maybe_null;
} }
...@@ -1992,8 +1993,6 @@ bool Item_func_group_concat::setup(THD *thd) ...@@ -1992,8 +1993,6 @@ bool Item_func_group_concat::setup(THD *thd)
uint const_fields; uint const_fields;
byte *record; byte *record;
qsort_cmp2 compare_key; qsort_cmp2 compare_key;
Copy_field *ptr;
Copy_field *end;
DBUG_ENTER("Item_func_group_concat::setup"); DBUG_ENTER("Item_func_group_concat::setup");
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
...@@ -2044,10 +2043,13 @@ bool Item_func_group_concat::setup(THD *thd) ...@@ -2044,10 +2043,13 @@ bool Item_func_group_concat::setup(THD *thd)
Note that in the table, we first have the ORDER BY fields, then the Note that in the table, we first have the ORDER BY fields, then the
field list. field list.
We need to set set_sum_field in true for storing value of blob in buffer
of a record instead of a pointer of one.
*/ */
if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, 0, if (!(table=create_tmp_table(thd, tmp_table_param, all_fields,
0, 0, 0,select_lex->options | thd->options, (ORDER*) 0, 0, TRUE,select_lex->options | thd->options,
(char *) ""))) HA_POS_ERROR,(char *) "")))
DBUG_RETURN(1); DBUG_RETURN(1);
table->file->extra(HA_EXTRA_NO_ROWS); table->file->extra(HA_EXTRA_NO_ROWS);
table->no_rows= 1; table->no_rows= 1;
...@@ -2055,16 +2057,6 @@ bool Item_func_group_concat::setup(THD *thd) ...@@ -2055,16 +2057,6 @@ bool Item_func_group_concat::setup(THD *thd)
key_length= table->reclength; key_length= table->reclength;
record= table->record[0]; record= table->record[0];
/*
We need to store value of blob in buffer of a record instead of a pointer of
one.
*/
ptr=tmp_table_param->copy_field;
end=tmp_table_param->copy_field_end;
for (; ptr != end; ptr++)
ptr->set(ptr->to_field,ptr->from_field,1);
/* Offset to first result field in table */ /* Offset to first result field in table */
field_list_offset= table->fields - (list.elements - const_fields); field_list_offset= table->fields - (list.elements - const_fields);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment