summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2008-03-28 11:27:03 +0200
committerunknown <gkodinov/kgeorge@magare.gmz>2008-03-28 11:27:03 +0200
commit347972bc702ea25c6e190c4fe723705bb43e0179 (patch)
tree5f927dd85241e80ab2966f2e01d6b98815903441 /sql/sql_select.cc
parent0cf83bbf56f13c4391e557cee5271259aff64d19 (diff)
parent183ded7ab385c54789964d49f066c5d757744395 (diff)
downloadmariadb-git-347972bc702ea25c6e190c4fe723705bb43e0179.tar.gz
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1
into magare.gmz:/home/kgeorge/mysql/work/merge-5.1-bugteam sql/sql_acl.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 94f869f5377..3db0898c0ac 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13158,6 +13158,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
tab->read_first_record= best_key_direction > 0 ?
join_read_first:join_read_last;
tab->type=JT_NEXT; // Read with index_first(), index_next()
+ if (select && select->quick)
+ {
+ delete select->quick;
+ select->quick= 0;
+ }
if (table->covering_keys.is_set(best_key))
{
table->key_read=1;
@@ -13168,15 +13173,27 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
{
tab->ref.key= -1;
tab->ref.key_parts= 0;
- if (select && select->quick)
- {
- delete select->quick;
- select->quick= 0;
- }
if (select_limit < table_records)
tab->limit= select_limit;
}
}
+ else if (tab->type != JT_ALL)
+ {
+ /*
+ We're about to use a quick access to the table.
+ We need to change the access method so as the quick access
+ method is actually used.
+ */
+ DBUG_ASSERT(tab->select->quick);
+ tab->type=JT_ALL;
+ tab->use_quick=1;
+ tab->ref.key= -1;
+ tab->ref.key_parts=0; // Don't use ref key.
+ tab->read_first_record= join_init_read_record;
+ /*
+ TODO: update the number of records in join->best_positions[tablenr]
+ */
+ }
}
used_key_parts= best_key_parts;
order_direction= best_key_direction;