Drizzled Public API Documentation

quick_index_merge_select.h
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #pragma once
21 
22 #include <drizzled/optimizer/range.h>
23 #include <drizzled/records.h>
24 
25 #include <boost/dynamic_bitset.hpp>
26 #include <vector>
27 
28 namespace drizzled
29 {
30 
31 namespace optimizer
32 {
33 
93 {
94 public:
95 
96  QuickIndexMergeSelect(Session *session, Table *table);
97 
99 
100  int init();
101  int reset(void);
102 
111  int get_next();
112 
113  bool reverse_sorted() const
114  {
115  return false;
116  }
117 
118  bool unique_key_range() const
119  {
120  return false;
121  }
122 
123  int get_type() const
124  {
125  return QS_TYPE_INDEX_MERGE;
126  }
127 
128  void add_keys_and_lengths(std::string *key_names, std::string *used_lengths);
129  void add_info_string(std::string *str);
130  bool is_keys_used(const boost::dynamic_bitset<>& fields);
131 
132  void push_quick_back(QuickRangeSelect *quick_sel_range);
133 
134  /* range quick selects this index_merge read consists of */
135  std::vector<QuickRangeSelect *> quick_selects;
136 
137  /* quick select that uses clustered primary key (NULL if none) */
138  QuickRangeSelect *pk_quick_select;
139 
140  /* true if this select is currently doing a clustered PK scan */
141  bool doing_pk_scan;
142 
143  memory::Root alloc;
144  Session *session;
145 
162  int read_keys_and_merge();
163 
164  /* used to get rows collected in Unique */
165  ReadRecord read_record;
166 };
167 
168 } /* namespace optimizer */
169 
170 } /* namespace drizzled */
171 
void add_keys_and_lengths(std::string *key_names, std::string *used_lengths)
bool is_keys_used(const boost::dynamic_bitset<> &fields)