summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-03-29 12:04:02 +0500
committerunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-03-29 12:04:02 +0500
commit66196e5511a248585dbf6e52137c5ba737a73eea (patch)
treec06b51b0612f82fa74e9b4d822031a59e6f3b03d /sql/item_sum.cc
parent7cdd99c129e4b206b7bf63fc8f1ed455a1f20d84 (diff)
parentc872b005e2987ebc10db219c5ce8657441fe3533 (diff)
downloadmariadb-git-66196e5511a248585dbf6e52137c5ba737a73eea.tar.gz
Merge mysql.com:/home/ram/work/b21976/my50-b21976
into mysql.com:/home/ram/work/b21976/my51-b21976 sql/item.h: Auto merged mysql-test/r/func_group.result: merging mysql-test/t/func_group.test: merging sql/item_sum.cc: merging
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc32
1 files changed, 5 insertions, 27 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index f34fc008186..371b21b257f 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1059,14 +1059,8 @@ void Item_sum_count::clear()
bool Item_sum_count::add()
{
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
count++;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- count++;
- }
return 0;
}
@@ -1908,14 +1902,8 @@ void Item_sum_count::reset_field()
char *res=result_field->ptr;
longlong nr=0;
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
nr=1;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- nr=1;
- }
int8store(res,nr);
}
@@ -2018,14 +2006,8 @@ void Item_sum_count::update_field()
char *res=result_field->ptr;
nr=sint8korr(res);
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
nr++;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- nr++;
- }
int8store(res,nr);
}
@@ -2449,12 +2431,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
Item *item=args[i];
if (list.push_back(item))
return TRUE; // End of memory
- if (item->const_item())
- {
- item->update_null_value();
- if (item->null_value)
- always_null=1;
- }
+ if (item->const_item() && item->is_null())
+ always_null= 1;
}
if (always_null)
return FALSE;