~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/table_read_plan.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_OPTIMIZER_TABLE_READ_PLAN_H
21
 
#define DRIZZLED_OPTIMIZER_TABLE_READ_PLAN_H
 
20
#pragma once
22
21
 
23
 
#include "drizzled/util/functors.h"
 
22
#include <drizzled/memory/sql_alloc.h>
 
23
#include <drizzled/util/functors.h>
24
24
#include <algorithm>
25
25
 
26
 
namespace drizzled
27
 
{
28
 
 
29
 
namespace optimizer
30
 
{
31
 
 
32
 
class Parameter;
33
 
class SEL_ARG;
34
 
class SEL_TREE;
35
 
class RorScanInfo;
 
26
namespace drizzled {
 
27
namespace optimizer {
36
28
 
37
29
/*
38
30
  Table rows retrieval plan. Range optimizer creates QuickSelectInterface-derived
39
31
  objects from table read plans.
40
32
*/
41
 
class TableReadPlan
 
33
class TableReadPlan : public memory::SqlAlloc
42
34
{
43
35
public:
44
36
  /*
74
66
                                           bool retrieve_full_rows,
75
67
                                           memory::Root *parent_alloc= NULL) = 0;
76
68
 
77
 
  /* Table read plans are allocated on memory::Root and are never deleted */
78
 
  static void *operator new(size_t size, memory::Root *mem_root)
79
 
  { 
80
 
    return (void*) mem_root->alloc_root((uint32_t) size); 
81
 
  }
82
 
 
83
 
  static void operator delete(void *, size_t)
84
 
  { }
85
 
 
86
 
  static void operator delete(void *, memory::Root *)
87
 
    { /* Never called */ }
88
 
 
89
69
  virtual ~TableReadPlan() {} /* Remove gcc warning */
90
 
 
91
70
};
92
71
 
93
72
 
99
78
*/
100
79
class RangeReadPlan : public TableReadPlan
101
80
{
102
 
 
103
81
public:
104
 
 
105
82
  SEL_ARG *key; /* set of intervals to be used in "range" method retrieval */
106
83
  uint32_t     key_idx; /* key number in Parameter::key */
107
84
  uint32_t     mrr_flags;
113
90
      key_idx(idx_arg),
114
91
      mrr_flags(mrr_flags_arg)
115
92
  {}
116
 
  virtual ~RangeReadPlan() {}                     /* Remove gcc warning */
117
93
 
118
94
  QuickSelectInterface *make_quick(Parameter *param, bool, memory::Root *parent_alloc);
119
 
 
120
95
};
121
96
 
122
97
 
124
99
class RorIntersectReadPlan : public TableReadPlan
125
100
{
126
101
public:
127
 
 
128
 
  RorIntersectReadPlan() {}                      /* Remove gcc warning */
129
 
  virtual ~RorIntersectReadPlan() {}             /* Remove gcc warning */
130
 
 
131
102
  QuickSelectInterface *make_quick(Parameter *param,
132
103
                                   bool retrieve_full_rows,
133
104
                                   memory::Root *parent_alloc);
152
123
class RorUnionReadPlan : public TableReadPlan
153
124
{
154
125
public:
155
 
  RorUnionReadPlan() {}                          /* Remove gcc warning */
156
 
  virtual ~RorUnionReadPlan() {}                 /* Remove gcc warning */
157
126
  QuickSelectInterface *make_quick(Parameter *param,
158
127
                                   bool retrieve_full_rows,
159
128
                                   memory::Root *parent_alloc);
171
140
class IndexMergeReadPlan : public TableReadPlan
172
141
{
173
142
public:
174
 
  IndexMergeReadPlan() {}                        /* Remove gcc warning */
175
 
  virtual ~IndexMergeReadPlan() {}               /* Remove gcc warning */
176
143
  QuickSelectInterface *make_quick(Parameter *param,
177
144
                                   bool retrieve_full_rows,
178
145
                                   memory::Root *parent_alloc);
206
173
  ha_rows quick_prefix_records;
207
174
 
208
175
public:
209
 
  GroupMinMaxReadPlan(bool have_min_arg, 
 
176
  GroupMinMaxReadPlan(bool have_min_arg,
210
177
                      bool have_max_arg,
211
178
                      KeyPartInfo *min_max_arg_part_arg,
212
 
                      uint32_t group_prefix_len_arg, 
 
179
                      uint32_t group_prefix_len_arg,
213
180
                      uint32_t used_key_parts_arg,
214
 
                      uint32_t group_key_parts_arg, 
 
181
                      uint32_t group_key_parts_arg,
215
182
                      KeyInfo *index_info_arg,
216
 
                      uint32_t index_arg, 
 
183
                      uint32_t index_arg,
217
184
                      uint32_t key_infix_len_arg,
218
185
                      unsigned char *key_infix_arg,
219
 
                      SEL_TREE *tree_arg, 
 
186
                      SEL_TREE *tree_arg,
220
187
                      SEL_ARG *index_tree_arg,
221
 
                      uint32_t param_idx_arg, 
 
188
                      uint32_t param_idx_arg,
222
189
                      ha_rows quick_prefix_records_arg)
223
190
    :
224
191
      have_min(have_min_arg),
238
205
      if (key_infix_len)
239
206
        memcpy(this->key_infix, key_infix_arg, key_infix_len);
240
207
    }
241
 
  virtual ~GroupMinMaxReadPlan() {}             /* Remove gcc warning */
242
208
 
243
209
  QuickSelectInterface *make_quick(Parameter *param,
244
210
                                   bool retrieve_full_rows,
250
216
 
251
217
} /* namespace drizzled */
252
218
 
253
 
#endif /* DRIZZLED_OPTIMIZER_TABLE_READ_PLAN_H */