summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-06-23 12:29:05 +0200
committerunknown <serg@serg.mylan>2004-06-23 12:29:05 +0200
commit9a554b4751237bc96f9ad6eae2df8b310567479d (patch)
treeed41d441646213c959f138d9a933c09f994d81d9 /sql/opt_range.cc
parent16c5f173e825ff9936e5d3c96d4bf20210788ad2 (diff)
downloadmariadb-git-9a554b4751237bc96f9ad6eae2df8b310567479d.tar.gz
handler interface cleanups:
more logical table/index_flags return HA_ERR_WRONG_COMMAND instead of abstract methods where appropriate max_keys and other limits renamed to max_supported_keys/etc max_keys/etc are now wrappers to max_supported_keys/etc ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to real {index,rnd}_{init,end} to enforce strict pairing include/myisam.h: increasing myisam_max_temp_file_length include/my_base.h: handler interface cleanup myisam/mi_static.c: warning removed mysql-test/Makefile.am: followup mysql-test/r/fulltext.result: fulltext indexes are not ordered mysql-test/r/rpl_user_variables.result: followup sql/field.cc: index_flags sql/filesort.cc: rnd_init -> ha_rnd_init rnd_end -> ha_rnd_end sql/ha_berkeley.cc: cleanup sql/ha_berkeley.h: table/index_flags revamped sql/ha_heap.cc: ensure index is accessed only after index_init (esp. important for temp tables) sql/ha_heap.h: table/index_flags revamped sql/ha_innodb.cc: don't workaround MySQL sloppiness sql/ha_innodb.h: table/index_flags revamped sql/ha_isam.h: table/index_flags revamped sql/ha_isammrg.h: table/index_flags revamped sql/ha_myisam.cc: ensure index is accessed only after index_init (esp. important for temp tables) sql/ha_myisam.h: table/index_flags revamped sql/ha_myisammrg.h: table/index_flags revamped sql/handler.cc: handler interface cleanups sql/handler.h: handler interface cleanups: more logical table/index_flags return HA_ERR_WRONG_COMMAND instead of abstract methods max_keys and other limits renamed to max_supported_keys/etc max_keys/etc are now wrappers to max_supported_keys/etc ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to enforce strict pairing sql/item_subselect.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/lex.h: renamed to avoid conflicts sql/opt_range.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed table/index_flags cleanup sql/opt_range.h: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/opt_sum.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed table/index_flags cleanup sql/records.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_acl.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_cache.cc: cleanup sql/sql_delete.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_handler.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_help.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_insert.cc: table/index_flags cleanup sql/sql_select.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed table/index_flags cleanup sql/sql_table.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed table/index_flags cleanup sql/sql_update.cc: index_init/index_end/rnd_init/rnd_end strict pairing fixed sql/sql_yacc.yy: INDEX -> INDEX_SYM sql/table.cc: table/index_flags cleanup
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc42
1 files changed, 6 insertions, 36 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index a5d2450e551..4bf2f7b724e 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -413,7 +413,7 @@ QUICK_SELECT::~QUICK_SELECT()
{
if (!dont_free)
{
- file->index_end();
+ file->ha_index_end();
free_root(&alloc,MYF(0));
}
}
@@ -609,7 +609,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
table_map prev_tables,
ha_rows limit, bool force_quick_range)
{
- uint basflag;
uint idx;
double scan_time;
DBUG_ENTER("test_quick_select");
@@ -623,9 +622,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
if (!cond || (specialflag & SPECIAL_SAFE_MODE) && ! force_quick_range ||
!limit)
DBUG_RETURN(0); /* purecov: inspected */
- if (!((basflag= head->file->table_flags()) & HA_KEYPOS_TO_RNDPOS) &&
- keys_to_use.is_set_all() || keys_to_use.is_clear_all())
- DBUG_RETURN(0); /* Not smart database */
+ if (keys_to_use.is_clear_all())
+ DBUG_RETURN(0);
records=head->file->records;
if (!records)
records++; /* purecov: inspected */
@@ -651,7 +649,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
/* set up parameter that is passed to all functions */
param.thd= thd;
- param.baseflag=basflag;
+ param.baseflag=head->file->table_flags();
param.prev_tables=prev_tables | const_tables;
param.read_tables=read_tables;
param.current_table= head->map;
@@ -728,7 +726,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
found_records=check_quick_select(&param, idx, *key);
if (found_records != HA_POS_ERROR && found_records > 2 &&
head->used_keys.is_set(keynr) &&
- (head->file->index_flags(keynr) & HA_KEY_READ_ONLY))
+ (head->file->index_flags(keynr) & HA_KEYREAD_ONLY))
{
/*
We can resolve this by only reading through this key.
@@ -2356,7 +2354,7 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree)
0);
else
quick=new QUICK_SELECT(param->thd, param->table, param->real_keynr[idx]);
-
+
if (quick)
{
if (quick->error ||
@@ -2530,7 +2528,6 @@ static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
{
- table->file->index_end(); // Remove old cursor
QUICK_SELECT *quick=new QUICK_SELECT(thd, table, ref->key, 1);
KEY *key_info = &table->key_info[ref->key];
KEY_PART *key_part;
@@ -2691,20 +2688,12 @@ int QUICK_SELECT_GEOM::get_next()
QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
: QUICK_SELECT(*q), rev_it(rev_ranges)
{
- bool not_read_after_key = file->table_flags() & HA_NOT_READ_AFTER_KEY;
QUICK_RANGE *r;
it.rewind();
for (r = it++; r; r = it++)
{
rev_ranges.push_front(r);
- if (not_read_after_key && range_reads_after_key(r))
- {
- it.rewind(); // Reset range
- error = HA_ERR_UNSUPPORTED;
- dont_free=1; // Don't free memory from 'q'
- return;
- }
}
/* Remove EQ_RANGE flag for keys that are not using the full key */
for (r = rev_it++; r; r = rev_it++)
@@ -2774,29 +2763,10 @@ int QUICK_SELECT_DESC::get_next()
else
{
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
-#ifndef NOT_IMPLEMENTED_YET
result=file->index_read(record, (byte*) range->max_key,
range->max_length,
((range->flag & NEAR_MAX) ?
HA_READ_BEFORE_KEY : HA_READ_PREFIX_LAST_OR_PREV));
-#else
- /*
- Heikki changed Sept 11, 2002: since InnoDB does not store the cursor
- position if READ_KEY_EXACT is used to a primary key with all
- key columns specified, we must use below HA_READ_KEY_OR_NEXT,
- so that InnoDB stores the cursor position and is able to move
- the cursor one step backward after the search.
- */
- /*
- Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
- do the right thing - go past all keys which match the prefix
- */
- result=file->index_read(record, (byte*) range->max_key,
- range->max_length,
- ((range->flag & NEAR_MAX) ?
- HA_READ_KEY_OR_NEXT : HA_READ_AFTER_KEY));
- result = file->index_prev(record);
-#endif
}
if (result)
{