Drizzled Public API Documentation

quick_index_merge_select.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 #include <drizzled/optimizer/range.h>
00023 #include <drizzled/records.h>
00024 
00025 #include <boost/dynamic_bitset.hpp>
00026 #include <vector>
00027 
00028 namespace drizzled
00029 {
00030 
00031 namespace optimizer
00032 {
00033 
00092 class QuickIndexMergeSelect : public QuickSelectInterface
00093 {
00094 public:
00095 
00096   QuickIndexMergeSelect(Session *session, Table *table);
00097 
00098   ~QuickIndexMergeSelect();
00099 
00100   int init();
00101   int reset(void);
00102 
00111   int get_next();
00112 
00113   bool reverse_sorted() const
00114   {
00115     return false;
00116   }
00117 
00118   bool unique_key_range() const
00119   {
00120     return false;
00121   }
00122 
00123   int get_type() const
00124   {
00125     return QS_TYPE_INDEX_MERGE;
00126   }
00127 
00128   void add_keys_and_lengths(std::string *key_names, std::string *used_lengths);
00129   void add_info_string(std::string *str);
00130   bool is_keys_used(const boost::dynamic_bitset<>& fields);
00131 
00132   bool push_quick_back(QuickRangeSelect *quick_sel_range);
00133 
00134   /* range quick selects this index_merge read consists of */
00135   std::vector<QuickRangeSelect *> quick_selects;
00136 
00137   /* quick select that uses clustered primary key (NULL if none) */
00138   QuickRangeSelect *pk_quick_select;
00139 
00140   /* true if this select is currently doing a clustered PK scan */
00141   bool  doing_pk_scan;
00142 
00143   memory::Root alloc;
00144   Session *session;
00145 
00162   int read_keys_and_merge();
00163 
00164   /* used to get rows collected in Unique */
00165   ReadRecord read_record;
00166 };
00167 
00168 } /* namespace optimizer */
00169 
00170 } /* namespace drizzled */
00171