summaryrefslogtreecommitdiff
path: root/sql/item_sum.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/item_sum.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/item_sum.cc')
-rw-r--r--sql/item_sum.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 4b7415b6829..0676632d477 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2671,11 +2671,11 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
TABLE *table= item->table;
char *record= (char*) table->record[0] + table->s->null_bytes;
String tmp(table->record[1], table->s->reclength, default_charset_info), tmp2;
- String &result= item->result;
+ String *result= &item->result;
Item **arg= item->args, **arg_end= item->args + item->arg_count_field;
- if (result.length())
- result.append(*item->separator);
+ if (result->length())
+ result->append(*item->separator);
tmp.length(0);
@@ -2702,14 +2702,14 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
else
res= (*arg)->val_str(&tmp);
if (res)
- result.append(*res);
+ result->append(*res);
}
/* stop if length of result more than max_length */
- if (result.length() > item->max_length)
+ if (result->length() > item->max_length)
{
item->count_cut_values++;
- result.length(item->max_length);
+ result->length(item->max_length);
item->warning_for_row= TRUE;
return 1;
}
@@ -2910,8 +2910,6 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
MYF(0));
return TRUE;
}
- if (!args) /* allocation in constructor may fail */
- return TRUE;
thd->allow_sum_func= 0;
maybe_null= 0;
@@ -2972,12 +2970,10 @@ bool Item_func_group_concat::setup(THD *thd)
if (item->null_value)
{
always_null= 1;
- break;
+ DBUG_RETURN(FALSE);
}
}
}
- if (always_null)
- DBUG_RETURN(FALSE);
List<Item> all_fields(list);
/*