~drizzle-trunk/drizzle/development

1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
21
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
22
#include <drizzled/optimizer/range.h>
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
23
1237.13.15 by Padraig O'Sullivan
Used std::vector instead of List in the QuickRorUnionSelect class.
24
#include <vector>
25
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
26
namespace drizzled
27
{
28
29
namespace optimizer
30
{
31
32
class compare_functor;
33
34
/**
35
  Rowid-Ordered Retrieval index union select.
36
  This quick select produces union of row sequences returned by several
37
  quick select it "merges".
38
39
  All merged quick selects must return rowids in rowid order.
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
40
  QuickRorUnionSelect will return rows in rowid order, too.
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
41
42
  All merged quick selects are set not to retrieve full table records.
43
  ROR-union quick select always retrieves full records.
44
45
*/
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
46
class QuickRorUnionSelect : public QuickSelectInterface
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
47
{
48
public:
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
49
  QuickRorUnionSelect(Session *session, Table *table);
50
  ~QuickRorUnionSelect();
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
51
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
52
  /**
53
   * Do post-constructor initialization.
54
   * SYNOPSIS
55
   * QuickRorUnionSelect::init()
56
   *
57
   * RETURN
58
   * @retval 0      OK
59
   * @retval other  Error code
60
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
61
  int  init();
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
62
63
  /**
64
   * Initialize quick select for row retrieval.
65
   * SYNOPSIS
66
   * reset()
67
   *
68
   * RETURN
69
   * @retval 0      OK
70
   * @retval other  Error code
71
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
72
  int  reset(void);
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
73
74
  /**
75
   * Retrieve next record.
76
   * SYNOPSIS
77
   * QuickRorUnionSelect::get_next()
78
   *
79
   * NOTES
80
   * Enter/exit invariant:
81
   * For each quick select in the queue a {key,rowid} tuple has been
82
   * retrieved but the corresponding row hasn't been passed to output.
83
   *
84
   * RETURN
85
   * @retval 0     - Ok
86
   * @retval other - Error code if any error occurred.
87
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
88
  int  get_next();
89
90
  bool reverse_sorted() const
91
  {
92
    return false;
93
  }
94
95
  bool unique_key_range() const
96
  {
97
    return false;
98
  }
99
100
  int get_type() const
101
  {
102
    return QS_TYPE_ROR_UNION;
103
  }
104
2170.4.4 by Stewart Smith
tmp3 String to std::string in explain_plan (and used_lengths parameter to add_keys_and_lengths
105
  void add_keys_and_lengths(std::string *key_names, std::string *used_lengths);
2170.4.5 by Stewart Smith
convert explain_plan extra String to std::string. This means that add_info_string() also gets converted to std::string
106
  void add_info_string(std::string *str);
1802.16.6 by Padraig O'Sullivan
Added temporary conversion of a bitmap to dynamic_bitset in order to remove references to MyBitmap within optimizer code.
107
  bool is_keys_used(const boost::dynamic_bitset<>& fields);
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
108
109
  bool push_quick_back(QuickSelectInterface *quick_sel_range);
110
1237.13.15 by Padraig O'Sullivan
Used std::vector instead of List in the QuickRorUnionSelect class.
111
  std::vector<QuickSelectInterface *> quick_selects; /**< Merged quick selects */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
112
113
  /** Priority queue for merge operation */
114
  std::priority_queue<QuickSelectInterface *, std::vector<QuickSelectInterface *>, compare_functor > *queue;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
115
  memory::Root alloc; /**< Memory pool for this and merged quick selects data. */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
116
117
  Session *session; /**< current thread */
118
  unsigned char *cur_rowid; /**< buffer used in get_next() */
119
  unsigned char *prev_rowid; /**< rowid of last row returned by get_next() */
120
  bool have_prev_rowid; /**< true if prev_rowid has valid data */
121
  uint32_t rowid_length; /**< table rowid length */
122
private:
123
  bool scans_inited;
124
};
125
126
} /* namespace optimizer */
127
128
} /* namespace drizzled */
129