diff options
author | msvensson@pilot.blaudden <> | 2007-04-02 11:15:09 +0200 |
---|---|---|
committer | msvensson@pilot.blaudden <> | 2007-04-02 11:15:09 +0200 |
commit | fc904eaead6c3d406b105f403eb7457dc3a7261a (patch) | |
tree | 860e498cb6cf393f31952a9863cfe2af46ba7adc /sql/item_sum.cc | |
parent | 8b8a61d77a1cb6c925469b0e6b0ca101551e4bfe (diff) | |
parent | cbe7c63fc75a0a5fca09c92ba0ffbbd7d85eb647 (diff) | |
download | mariadb-git-fc904eaead6c3d406b105f403eb7457dc3a7261a.tar.gz |
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.1
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7c3762d4785..f217a6ea953 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1090,14 +1090,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; } @@ -1940,14 +1934,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); } @@ -2050,14 +2038,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); } @@ -2481,12 +2463,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; |