1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Cleanups during review of code

Fixed newly introduced bug in rollup


client/mysqldump.c:
  Safer buffer allocation
  Removed wrong assert
mysql-test/r/olap.result:
  more tests
mysql-test/t/olap.test:
  more tests
sql/handler.cc:
  Simple cleanup
  Fixed wrong check for next digit (wrong debug output)
sql/item.cc:
  Replace shrink_to_length() with mark_as_const() as the former allowed one to do changes to the string
sql/item_sum.cc:
  Change reference to pointer
  Trivial optimzation of testing 'allways_null'
sql/mysqld.cc:
  Proper indentation of comment
sql/sql_select.cc:
  Fixed newly introduced bug in rollup
sql/sql_string.h:
  Remove not needed 'shrink_to_length()'
  Added 'mark_as_const()' to be used when one want to ensure that a string is not changed
This commit is contained in:
unknown
2005-03-21 23:41:28 +02:00
parent 2ba3544f0e
commit 802c41e04d
9 changed files with 86 additions and 45 deletions

View File

@ -10145,20 +10145,18 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
join->sum_funcs_end[send_group_parts]);
if (join->having && join->having->val_int() == 0)
error= -1;
else if ((error=table->file->write_row(table->record[0])))
else if ((error= table->file->write_row(table->record[0])))
{
if (create_myisam_from_heap(join->thd, table,
&join->tmp_table_param,
error, 0))
DBUG_RETURN(-1);
}
if (join->rollup.state != ROLLUP::STATE_NONE && error <= 0)
if (join->rollup.state != ROLLUP::STATE_NONE)
{
if (join->rollup_write_data((uint) (idx+1), table))
error= 1;
DBUG_RETURN(-1);
}
if (error > 0)
DBUG_RETURN(-1);
if (end_of_records)
DBUG_RETURN(0);
}
@ -12685,17 +12683,21 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
{
/* Check if this is something that is part of this group by */
ORDER *group_tmp;
for (group_tmp= start_group, i-- ;
for (group_tmp= start_group, i= pos ;
group_tmp ; group_tmp= group_tmp->next, i++)
{
if (*group_tmp->item == item)
{
Item_null_result *null_item;
/*
This is an element that is used by the GROUP BY and should be
set to NULL in this level
*/
item->maybe_null= 1; // Value will be null sometimes
Item_null_result *null_item= rollup.null_items[i];
null_item= rollup.null_items[i];
DBUG_ASSERT(null_item->result_field == 0 ||
null_item->result_field ==
((Item_field *) item)->result_field);
null_item->result_field= ((Item_field *) item)->result_field;
item= null_item;
break;