summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-03-29 13:37:07 +0500
committerramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-03-29 13:37:07 +0500
commitc1320384514863bae3ede13ce7398d7574e1179c (patch)
tree7ebe1c687b4955d6d97c7a4b089e5765976a79a7 /sql/item_sum.cc
parent73f0c5d7c623d275c783a9d733a9f3c33c995bb1 (diff)
parent294ae90d9c8e997f481a982fde926203864b4591 (diff)
downloadmariadb-git-c1320384514863bae3ede13ce7398d7574e1179c.tar.gz
Merge mysql.com:/home/ram/work/mysql-5.0-maint
into mysql.com:/home/ram/work/b21976/my50-b21976
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 41f0dd6496b..9c3c5f2053d 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1050,14 +1050,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;
}
@@ -1890,14 +1884,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);
}
@@ -2000,14 +1988,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);
}
@@ -2431,12 +2413,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;