summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-02-05 10:22:08 +0100
committerunknown <monty@mysql.com>2004-02-05 10:22:08 +0100
commit0db0b601abb3be2fdafa612583f4e03360876236 (patch)
treea27a7e48b7584f9668ca17e4d0817c9d817ca9f2 /sql/opt_range.cc
parente44a7da25f4bc5e2be0303b527eb60a323178a68 (diff)
downloadmariadb-git-0db0b601abb3be2fdafa612583f4e03360876236.tar.gz
Added SQL_SELECT::cleanup() to make it easier to reuse SQL_SELECT item's for sub selects. Needed for proper fix for bug #2479.
Added 'select_to_file' class to be able to merge identical code for select_export and select_dump client/mysql.cc: Print mysql_insert_id() in 'status' mysys/charset.c: after merge fixup sql/item_func.cc: Code cleanup + new comments sql/opt_range.cc: Added SQL_SELECT::cleanup() to make it easier to reuse SQL_SELECT item's for sub selects. sql/opt_range.h: Added SQL_SELECT::cleanup() to make it easier to reuse SQL_SELECT item's for sub selects. sql/sql_class.cc: Added 'select_to_file' class to be able to merge identical code for select_export and select_dump sql/sql_class.h: Added 'select_to_file' class to be able to merge identical code for select_export and select_dump sql/sql_select.cc: Fixed bug when calling 'delete select' in sub selects. (Bug 2479) (Test case is already commited to global source repository)
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index acc23924f75..17fc948dd6e 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -369,14 +369,25 @@ SQL_SELECT::SQL_SELECT() :quick(0),cond(0),free_cond(0)
}
-SQL_SELECT::~SQL_SELECT()
+void SQL_SELECT::cleanup()
{
delete quick;
+ quick= 0;
if (free_cond)
+ {
+ free_cond=0;
delete cond;
+ cond= 0;
+ }
close_cached_file(&file);
}
+
+SQL_SELECT::~SQL_SELECT()
+{
+ cleanup();
+}
+
#undef index // Fix for Unixware 7
QUICK_SELECT::QUICK_SELECT(THD *thd, TABLE *table, uint key_nr, bool no_alloc)
@@ -2180,6 +2191,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
param->table->quick_rows[key]=records;
param->table->quick_key_parts[key]=param->max_key_part+1;
}
+ DBUG_PRINT("exit", ("Records: %lu", (ulong) records));
DBUG_RETURN(records);
}
@@ -2532,12 +2544,7 @@ int QUICK_SELECT::get_next()
int result;
if (range)
{ // Already read through key
-/* result=((range->flag & EQ_RANGE) ?
- file->index_next_same(record, (byte*) range->min_key,
- range->min_length) :
- file->index_next(record));
-*/
- result=((range->flag & (EQ_RANGE | GEOM_FLAG) ) ?
+ result=((range->flag & (EQ_RANGE | GEOM_FLAG)) ?
file->index_next_same(record, (byte*) range->min_key,
range->min_length) :
file->index_next(record));