diff options
author | unknown <monty@work.mysql.com> | 2001-06-21 11:03:54 +0200 |
---|---|---|
committer | unknown <monty@work.mysql.com> | 2001-06-21 11:03:54 +0200 |
commit | 8f33f8d4d36080b161fac72971239afd4bf3137f (patch) | |
tree | d2250b6064dd50f4270103879fdb86f3874d09c5 /sql/item_sum.cc | |
parent | 9227621cceec8d0c00a513ca33e3a63dba3e8e85 (diff) | |
parent | 066eddd86208ff7aff062efce1957a66618de854 (diff) | |
download | mariadb-git-8f33f8d4d36080b161fac72971239afd4bf3137f.tar.gz |
merge
Docs/manual.texi:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_base.cc:
Auto merged
mysql-test/t/bdb.test:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index fb20d31ee90..2cf23d48bc6 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -875,8 +875,19 @@ bool Item_sum_count_distinct::setup(THD *thd) List<Item> list; /* Create a table with an unique key over all parameters */ for (uint i=0; i < arg_count ; i++) - if (list.push_back(args[i])) - return 1; + { + Item *item=args[i]; + if (list.push_back(item)) + return 1; // End of memory + if (item->const_item()) + { + (void) item->val_int(); + if (item->null_value) + always_null=1; + } + } + if (always_null) + return 0; count_field_types(tmp_table_param,list,0); if (table) { @@ -978,20 +989,22 @@ int Item_sum_count_distinct::tree_to_myisam() void Item_sum_count_distinct::reset() { - if(use_tree) + if (use_tree) reset_tree(&tree); - else - { - table->file->extra(HA_EXTRA_NO_CACHE); - table->file->delete_all_rows(); - table->file->extra(HA_EXTRA_WRITE_CACHE); - } + else if (table) + { + table->file->extra(HA_EXTRA_NO_CACHE); + table->file->delete_all_rows(); + table->file->extra(HA_EXTRA_WRITE_CACHE); + } (void) add(); } bool Item_sum_count_distinct::add() { int error; + if (always_null) + return 0; copy_fields(tmp_table_param); copy_funcs(tmp_table_param->funcs); |