~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
2252.1.21 by Olaf van der Spek
Common fwd
26
namespace drizzled {
27
namespace optimizer {
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
28
29
/**
30
  Rowid-Ordered Retrieval index union select.
31
  This quick select produces union of row sequences returned by several
32
  quick select it "merges".
33
34
  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
35
  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.
36
37
  All merged quick selects are set not to retrieve full table records.
38
  ROR-union quick select always retrieves full records.
39
40
*/
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
41
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.
42
{
43
public:
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
44
  QuickRorUnionSelect(Session *session, Table *table);
45
  ~QuickRorUnionSelect();
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
46
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
47
  /**
48
   * Do post-constructor initialization.
49
   * SYNOPSIS
50
   * QuickRorUnionSelect::init()
51
   *
52
   * RETURN
53
   * @retval 0      OK
54
   * @retval other  Error code
55
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
56
  int  init();
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
57
58
  /**
59
   * Initialize quick select for row retrieval.
60
   * SYNOPSIS
61
   * reset()
62
   *
63
   * RETURN
64
   * @retval 0      OK
65
   * @retval other  Error code
66
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
67
  int  reset(void);
1237.13.14 by Padraig O'Sullivan
Corrected some style issues in quick_ror_union_select.[cc,h] and range.cc
68
69
  /**
70
   * Retrieve next record.
71
   * SYNOPSIS
72
   * QuickRorUnionSelect::get_next()
73
   *
74
   * NOTES
75
   * Enter/exit invariant:
76
   * For each quick select in the queue a {key,rowid} tuple has been
77
   * retrieved but the corresponding row hasn't been passed to output.
78
   *
79
   * RETURN
80
   * @retval 0     - Ok
81
   * @retval other - Error code if any error occurred.
82
   */
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
83
  int  get_next();
84
85
  bool reverse_sorted() const
86
  {
87
    return false;
88
  }
89
90
  bool unique_key_range() const
91
  {
92
    return false;
93
  }
94
95
  int get_type() const
96
  {
97
    return QS_TYPE_ROR_UNION;
98
  }
99
2170.4.4 by Stewart Smith
tmp3 String to std::string in explain_plan (and used_lengths parameter to add_keys_and_lengths
100
  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
101
  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.
102
  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.
103
2318.6.52 by Olaf van der Spek
Refactor
104
  void push_quick_back(QuickSelectInterface *quick_sel_range);
1237.13.13 by Padraig O'Sullivan
Moved the QUICK_ROR_UNION_SELECT class into its own header and implementation files.
105
1237.13.15 by Padraig O'Sullivan
Used std::vector instead of List in the QuickRorUnionSelect class.
106
  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.
107
108
  /** Priority queue for merge operation */
109
  std::priority_queue<QuickSelectInterface *, std::vector<QuickSelectInterface *>, compare_functor > *queue;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
110
  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.
111
112
  Session *session; /**< current thread */
113
  unsigned char *cur_rowid; /**< buffer used in get_next() */
114
  unsigned char *prev_rowid; /**< rowid of last row returned by get_next() */
115
  bool have_prev_rowid; /**< true if prev_rowid has valid data */
116
  uint32_t rowid_length; /**< table rowid length */
117
private:
118
  bool scans_inited;
119
};
120
121
} /* namespace optimizer */
122
123
} /* namespace drizzled */
124