summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-10-10 17:08:47 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-10-10 17:08:47 +0400
commit3177e8ebc49d95bb9c7768e5fc6aceb66bbb1783 (patch)
tree4528fd89be3dd96788b1cfa462033c391cc2076e /sql/item_sum.cc
parentebf58763e2e4970ab303813450105e1a193f8b9e (diff)
downloadmariadb-git-3177e8ebc49d95bb9c7768e5fc6aceb66bbb1783.tar.gz
BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared
statement. The problem was that during statement re-execution if the result was empty the old result could be returned for group functions. The solution is to implement proper cleanup() method in group functions. mysql-test/r/ps.result: Add result for bug#21354: (COUNT(*) = 1) not working in SELECT inside prepared statement. mysql-test/t/func_gconcat.test: Add a comment that the test case is from bug#836. mysql-test/t/ps.test: Add test case for bug#21354: (COUNT(*) = 1) not working in SELECT inside prepared statement. sql/item_sum.cc: Call clear() in Item_sum_count::cleanup(). sql/item_sum.h: Add comments. Add proper cleanup() methods. Change Item_sum::no_rows_in_result() to call clear() instead of reset(), as the latter also issues add(), and there is nothing to add when there are no rows in result.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 0b9b10d05d4..e480cb031d8 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -312,6 +312,7 @@ longlong Item_sum_count::val_int()
void Item_sum_count::cleanup()
{
DBUG_ENTER("Item_sum_count::cleanup");
+ clear();
Item_sum_int::cleanup();
used_table_cache= ~(table_map) 0;
DBUG_VOID_RETURN;