~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_table.h

  • Committer: Brian Aker
  • Date: 2009-07-11 05:59:19 UTC
  • mfrom: (1089.1.9 merge)
  • Revision ID: brian@gaz-20090711055919-m4px3crrdgta5lie
Collection of patches from new-cleanup (includes asserts for field in debug)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
/**
22
22
 * @file
23
23
 *
24
 
 * Defines the JOIN_TAB class which is the primary class
 
24
 * Defines the JoinTable class which is the primary class
25
25
 * used in the nested loops join implementation.
26
26
 */
27
27
 
28
 
#ifndef DRIZZLED_JOIN_TAB_H
29
 
#define DRIZZLED_JOIN_TAB_H
30
 
 
31
 
/* Values for JOIN_TAB::packed_info */
 
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
 
 
34
/* Values for JoinTable::packed_info */
32
35
#define TAB_INFO_HAVE_VALUE 1
33
36
#define TAB_INFO_USING_INDEX 2
34
37
#define TAB_INFO_USING_WHERE 4
35
38
#define TAB_INFO_FULL_SCAN_ON_NULL 8
36
39
 
37
 
typedef struct st_join_table 
 
40
class SemiJoinTable;
 
41
class KeyUse;
 
42
 
 
43
/** Description of a join type */
 
44
enum join_type 
 
45
 
46
  JT_UNKNOWN,
 
47
  JT_SYSTEM,
 
48
  JT_CONST,
 
49
  JT_EQ_REF,
 
50
  JT_REF,
 
51
  JT_MAYBE_REF,
 
52
        JT_ALL,
 
53
  JT_RANGE,
 
54
  JT_NEXT,
 
55
  JT_REF_OR_NULL,
 
56
  JT_UNIQUE_SUBQUERY,
 
57
  JT_INDEX_SUBQUERY,
 
58
  JT_INDEX_MERGE
 
59
};
 
60
 
 
61
 
 
62
class JoinTable 
38
63
{
39
 
  st_join_table() {} /* Remove gcc warning */
 
64
public:
 
65
  JoinTable() {} /* Remove gcc warning */
40
66
  Table *table;
41
 
  KEYUSE *keyuse; /**< pointer to first used key */
 
67
  KeyUse *keyuse; /**< pointer to first used key */
42
68
  SQL_SELECT *select;
43
69
  COND *select_cond;
44
70
  QUICK_SELECT_I *quick;
52
78
  Item *pre_idx_push_select_cond;
53
79
  Item **on_expr_ref;   /**< pointer to the associated on expression   */
54
80
  COND_EQUAL *cond_equal;    /**< multiple equalities for the on expression */
55
 
  st_join_table *first_inner;   /**< first inner table for including outerjoin */
 
81
  JoinTable *first_inner;   /**< first inner table for including outerjoin */
56
82
  bool found;         /**< true after all matches or null complement */
57
83
  bool not_null_compl;/**< true before null complement is added      */
58
 
  st_join_table *last_inner;    /**< last table table for embedding outer join */
59
 
  st_join_table *first_upper;  /**< first inner table for embedding outer join */
60
 
  st_join_table *first_unmatched; /**< used for optimization purposes only     */
 
84
  JoinTable *last_inner;    /**< last table table for embedding outer join */
 
85
  JoinTable *first_upper;  /**< first inner table for embedding outer join */
 
86
  JoinTable *first_unmatched; /**< used for optimization purposes only     */
61
87
 
62
88
  /* Special content for EXPLAIN 'Extra' column or NULL if none */
63
89
  const char *info;
128
154
  TableList *emb_sj_nest;
129
155
 
130
156
  /** Variables for semi-join duplicate elimination */
131
 
  SJ_TMP_TABLE *flush_weedout_table;
132
 
  SJ_TMP_TABLE *check_weed_out_table;
133
 
  struct st_join_table *do_firstmatch;
 
157
  SemiJoinTable *flush_weedout_table;
 
158
  SemiJoinTable *check_weed_out_table;
 
159
  JoinTable *do_firstmatch;
134
160
 
135
161
  /**
136
162
     ptr  - this join tab should do an InsideOut scan. Points
138
164
 
139
165
     NULL - Not an insideout scan.
140
166
  */
141
 
  struct st_join_table *insideout_match_tab;
 
167
  JoinTable *insideout_match_tab;
142
168
  unsigned char *insideout_buf; /**< Buffer to save index tuple to be able to skip dups */
143
169
 
144
170
  /** Used by InsideOut scan. Just set to true when have found a row. */
169
195
            (select->quick->get_type() ==
170
196
             QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX));
171
197
  }
172
 
} JOIN_TAB;
 
198
};
173
199
 
174
 
#endif /* DRIZZLED_JOIN_TAB_H */
 
200
#endif /* DRIZZLED_JOINTABLE_H */