~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/access_method/index.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-25 13:36:24 UTC
  • mto: This revision was merged to the branch mainline in revision 2349.
  • Revision ID: olafvdspek@gmail.com-20110625133624-hzy2ordecn161qco
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
#include <config.h>
22
 
#include <drizzled/session.h>
23
22
#include <drizzled/join_table.h>
 
23
#include <drizzled/optimizer/access_method/index.h>
24
24
#include <drizzled/sql_select.h>
25
 
#include <drizzled/optimizer/access_method/index.h>
 
25
#include <drizzled/table.h>
26
26
 
27
27
using namespace drizzled;
28
28
 
29
 
bool optimizer::Index::getStats(Table *table,
30
 
                                JoinTable *join_tab)
 
29
void optimizer::Index::getStats(Table& table, JoinTable& join_tab)
31
30
{
32
 
  table->status= STATUS_NO_RECORD;
33
 
  if (join_tab->select)
34
 
  {
35
 
    delete join_tab->select->quick;
36
 
    join_tab->select->quick= 0;
37
 
  }
38
 
 
39
 
  delete join_tab->quick;
40
 
  join_tab->quick= 0;
41
 
 
42
 
  if (table->covering_keys.test(join_tab->ref.key) && 
43
 
      ! table->no_keyread)
44
 
  {
45
 
    table->key_read= 1;
46
 
    table->cursor->extra(HA_EXTRA_KEYREAD);
47
 
  }
48
 
 
49
 
  if (join_tab->type == AM_REF)
50
 
  {
51
 
    join_tab->read_first_record= join_read_always_key;
52
 
    join_tab->read_record.read_record= join_tab->insideout_match_tab ?
 
31
  table.status= STATUS_NO_RECORD;
 
32
  if (join_tab.select)
 
33
  {
 
34
    delete join_tab.select->quick;
 
35
    join_tab.select->quick= 0;
 
36
  }
 
37
 
 
38
  delete join_tab.quick;
 
39
  join_tab.quick= 0;
 
40
 
 
41
  if (table.covering_keys.test(join_tab.ref.key) && 
 
42
      ! table.no_keyread)
 
43
  {
 
44
    table.key_read= 1;
 
45
    table.cursor->extra(HA_EXTRA_KEYREAD);
 
46
  }
 
47
 
 
48
  if (join_tab.type == AM_REF)
 
49
  {
 
50
    join_tab.read_first_record= join_read_always_key;
 
51
    join_tab.read_record.read_record= join_tab.insideout_match_tab ?
53
52
      join_read_next_same_diff : join_read_next_same;
54
53
  }
55
54
  else
56
55
  {
57
 
    join_tab->read_first_record= join_read_always_key_or_null;
58
 
    join_tab->read_record.read_record= join_read_next_same_or_null;
 
56
    join_tab.read_first_record= join_read_always_key_or_null;
 
57
    join_tab.read_record.read_record= join_read_next_same_or_null;
59
58
  }
60
 
 
61
 
  return false;
62
59
}