From ec963a61e22f690646b2ff8c13e74a16a54ddf6b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Aug 2006 19:20:30 +0300 Subject: Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result Reseting subqueries with "quick" access methods was incomplete. Partially backported the correct reseting of QUICK_SELECTs from 5.x. mysql-test/r/subselect.result: Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result - test case mysql-test/t/subselect.test: Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result - test case sql/opt_range.cc: Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result - partially backported the correct reseting of QUICK_SELECTs from 5.x. sql/opt_range.h: Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result - partially backported the correct reseting of QUICK_SELECTs from 5.x. --- sql/opt_range.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sql/opt_range.cc') diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 57903ffe7b9..85125a4521a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2980,6 +2980,14 @@ int QUICK_SELECT::get_next() } } +void QUICK_SELECT::reset(void) +{ + next= 0; + it.rewind(); + range= 0; + if (file->inited == handler::NONE) + file->ha_index_init(index); +} /* Get next for geometrical indexes */ @@ -3201,7 +3209,11 @@ bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg, return 0; } #endif - +void QUICK_SELECT_DESC::reset(void) +{ + rev_it.rewind(); + QUICK_SELECT::reset(); +} /***************************************************************************** ** Print a quick range for debugging -- cgit v1.2.1