diff options
author | unknown <monty@mashka.mysql.fi> | 2003-04-15 22:04:16 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-04-15 22:04:16 +0300 |
commit | 3ac05ea4812531bd213de6b35508d7da0a679378 (patch) | |
tree | 59cab832c43f9b1e9dcb2b6d434d33955fd2c07e /sql/item_sum.cc | |
parent | 909596e030134e96a4cb403c92ed57570b6b7157 (diff) | |
download | mariadb-git-3ac05ea4812531bd213de6b35508d7da0a679378.tar.gz |
Fixed bug in SUM() with NULL:s
Added logging of warnings for failed connections with ssl.
Fixed bug in symbolic link handling on Windows
include/my_global.h:
Added replication flags from 4.1
mysql-test/r/func_group.result:
Added test for SUM(NULL)
mysql-test/t/func_group.test:
Added test for SUM(NULL)
sql/item_sum.cc:
Fixed bug in SUM() with NULL:s
sql/item_sum.h:
Fixed bug in SUM() with NULL:s
sql/mysqld.cc:
Added option --symbolic-links
Fixed bug in symbolic link handling on Windows
sql/net_serv.cc:
Code cleanup
sql/sql_acl.cc:
Added logging of warnings for failed connections with ssl.
sql/sql_show.cc:
Changed to use HAVE_REPLICATION instead of EMBEDDED_LIBRARY
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b6bbc12efd6..3a513505913 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -175,12 +175,14 @@ Item_sum_hybrid::fix_fields(THD *thd,TABLE_LIST *tables) void Item_sum_sum::reset() { - null_value=0; sum=0.0; Item_sum_sum::add(); + null_value=1; sum=0.0; Item_sum_sum::add(); } bool Item_sum_sum::add() { sum+=args[0]->val(); + if (!args[0]->null_value) + null_value= 0; return 0; } @@ -566,8 +568,10 @@ void Item_sum_sum::reset_field() { double nr=args[0]->val(); // Nulls also return 0 float8store(result_field->ptr,nr); - null_value=0; - result_field->set_notnull(); + if (args[0]->null_value) + result_field->set_null(); + else + result_field->set_notnull(); } @@ -623,7 +627,10 @@ void Item_sum_sum::update_field(int offset) float8get(old_nr,res+offset); nr=args[0]->val(); if (!args[0]->null_value) + { old_nr+=nr; + result_field->set_notnull(); + } float8store(res,old_nr); } |