~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_table.h

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
25
25
 * used in the nested loops join implementation.
26
26
 */
27
27
 
28
 
#ifndef DRIZZLED_JOIN_TABLE_H
29
 
#define DRIZZLED_JOIN_TABLE_H
30
 
 
31
 
#include "drizzled/enum_nested_loop_state.h"
32
 
#include "drizzled/table_reference.h"
33
 
#include "drizzled/optimizer/range.h"
34
 
#include "drizzled/join_cache.h"
35
 
#include "drizzled/optimizer/key_use.h"
36
 
 
37
 
#include "drizzled/records.h"
 
28
#ifndef DRIZZLED_JOINTABLE_H
 
29
#define DRIZZLED_JOINTABLE_H
 
30
 
 
31
#include <drizzled/enum_nested_loop_state.h>
 
32
#include <drizzled/table_reference.h>
 
33
#include <drizzled/opt_range.h>
 
34
#include <drizzled/join_cache.h>
38
35
 
39
36
#include <bitset>
40
37
 
41
 
namespace drizzled
42
 
{
43
 
 
44
 
class Table;
45
 
 
46
 
namespace optimizer
47
 
{
48
 
  class Position;
49
 
}
50
38
/* Values for JoinTable::packed_info */
51
39
#define TAB_INFO_HAVE_VALUE 1
52
40
#define TAB_INFO_USING_INDEX 2
53
41
#define TAB_INFO_USING_WHERE 4
54
42
#define TAB_INFO_FULL_SCAN_ON_NULL 8
55
43
 
 
44
class KeyUse;
 
45
class Table;
 
46
class SQL_SELECT;
 
47
 
 
48
 
56
49
/** Description of an access method */
57
50
enum access_method
58
51
75
68
class JoinTable 
76
69
{
77
70
public:
78
 
  JoinTable() :
79
 
    table(NULL),
80
 
    keyuse(NULL),
81
 
    select(NULL),
82
 
    select_cond(NULL),
83
 
    quick(NULL),
84
 
    pre_idx_push_select_cond(NULL),
85
 
    on_expr_ref(NULL),
86
 
    cond_equal(NULL),
87
 
    first_inner(NULL),
88
 
    found(false),
89
 
    not_null_compl(false),
90
 
    last_inner(NULL),
91
 
    first_upper(NULL),
92
 
    first_unmatched(NULL),
93
 
    packed_info(0),
94
 
    read_first_record(NULL),
95
 
    next_select(NULL),
96
 
    worst_seeks(0.0),
97
 
    const_keys(0),
98
 
    checked_keys(0),
99
 
    needed_reg(0),
100
 
    keys(0),
101
 
    records(0),
102
 
    found_records(0),
103
 
    read_time(0),
104
 
    dependent(0),
105
 
    key_dependent(0),
106
 
    use_quick(0),
107
 
    index(0),
108
 
    status(0),
109
 
    used_fields(0),
110
 
    used_fieldlength(0),
111
 
    used_blobs(0),
112
 
    type(AM_UNKNOWN),
113
 
    cached_eq_ref_table(0),
114
 
    eq_ref_table(0),
115
 
    not_used_in_distinct(0),
116
 
    sorted(0),
117
 
    limit(0),
118
 
    join(NULL),
119
 
    insideout_match_tab(NULL),
120
 
    insideout_buf(NULL),
121
 
    found_match(false),
122
 
    rowid_keep_flags(0),
123
 
    embedding_map(0)
124
 
  {}
 
71
  JoinTable() {} /* Remove gcc warning */
125
72
  Table *table;
126
 
  optimizer::KeyUse *keyuse; /**< pointer to first used key */
127
 
  optimizer::SqlSelect *select;
 
73
  KeyUse *keyuse; /**< pointer to first used key */
 
74
  SQL_SELECT *select;
128
75
  COND *select_cond;
129
 
  optimizer::QuickSelectInterface *quick;
 
76
  QUICK_SELECT_I *quick;
130
77
  /**
131
78
    The value of select_cond before we've attempted to do Index Condition
132
79
    Pushdown. We may need to restore everything back if we first choose one
154
101
 
155
102
  Read_record_func read_first_record;
156
103
  Next_select_func next_select;
157
 
  ReadRecord    read_record;
 
104
  READ_RECORD   read_record;
158
105
  /*
159
106
    Currently the following two fields are used only for a [NOT] IN subquery
160
107
    if it is executed by an alternative full table scan when the left operand of
161
108
    the subquery predicate is evaluated to NULL.
162
109
  */
163
110
  Read_record_func save_read_first_record; /**< to save read_first_record */
164
 
  int (*save_read_record) (ReadRecord *); /**< to save read_record.read_record */
 
111
  int (*save_read_record) (READ_RECORD *); /**< to save read_record.read_record */
165
112
  double worst_seeks;
166
113
  key_map       const_keys; /**< Keys with constant part */
167
114
  key_map       checked_keys; /**< Keys checked in find_best */
203
150
  */
204
151
  ha_rows limit;
205
152
  table_reference_st    ref;
206
 
  JoinCache cache;
207
 
  Join *join;
 
153
  JOIN_CACHE cache;
 
154
  JOIN *join;
208
155
 
209
156
  /**
210
157
     ptr  - this join tab should do an InsideOut scan. Points
242
189
  {
243
190
    return (select && select->quick &&
244
191
            (select->quick->get_type() ==
245
 
             optimizer::QuickSelectInterface::QS_TYPE_GROUP_MIN_MAX));
 
192
             QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX));
246
193
  }
247
194
 
248
195
  void readCachedRecord();
249
 
  int joinReadConstTable(optimizer::Position *pos);
250
 
  int joinReadSystem();
251
196
};
252
197
 
253
 
} /* namespace drizzled */
254
 
 
255
 
#endif /* DRIZZLED_JOIN_TABLE_H */
 
198
#endif /* DRIZZLED_JOINTABLE_H */