summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-03-21 23:41:28 +0200
committerunknown <monty@mysql.com>2005-03-21 23:41:28 +0200
commit802c41e04d0b4bb193abfff1b7084d3a6c971df6 (patch)
tree0dc25c2b0b090f45da0eec51acfbcb6d42180cd6 /sql/sql_select.cc
parent2ba3544f0e053d95e82b9a899fd9b86cbb19b9ce (diff)
downloadmariadb-git-802c41e04d0b4bb193abfff1b7084d3a6c971df6.tar.gz
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
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1e05400e88e..f8caabaead4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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;