drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
position.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 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/join_table.h>
23
24namespace drizzled
25{
26namespace optimizer
27{
28
33class Position
34{
35public:
36
37 Position()
38 :
39 records_read(0),
40 read_time(0),
41 table(NULL),
42 key(NULL),
44 {}
45
46 Position(double in_records_read,
47 double in_read_time,
48 JoinTable *in_table,
49 KeyUse *in_key,
50 table_map in_ref_depend_map)
51 :
52 records_read(in_records_read),
53 read_time(in_read_time),
54 table(in_table),
55 key(in_key),
56 ref_depend_map(in_ref_depend_map)
57 {}
58
59 Position(const Position &rhs)
60 :
63 table(rhs.table),
64 key(rhs.key),
66 {}
67
68 Position &operator=(const Position &rhs)
69 {
70 if (this == &rhs)
71 {
72 return *this;
73 }
76 table= rhs.table;
77 key= rhs.key;
79 return *this;
80 }
81
96 bool isConstTable() const
97 {
98 return (records_read < 2.0);
99 }
100
101 double getFanout() const
102 {
103 return records_read;
104 }
105
106 void setFanout(double in_records_read)
107 {
108 records_read= in_records_read;
109 }
110
111 double getCost() const
112 {
113 return read_time;
114 }
115
116 JoinTable *getJoinTable()
117 {
118 return table;
119 }
120
128 bool hasTableForSorting(Table *cmp_table) const
129 {
130 return (cmp_table != table->table);
131 }
132
133 bool examinePosition(table_map found_ref);
134
135 KeyUse *getKeyUse()
136 {
137 return key;
138 }
139
140 table_map getRefDependMap() const
141 {
142 return ref_depend_map;
143 }
144
145 void clearRefDependMap()
146 {
148 }
149
150private:
151
158
164 double read_time;
165
166 JoinTable *table;
167
173
175 table_map ref_depend_map;
176
177};
178
179} /* end namespace optimizer */
180
181} /* end namespace drizzled */
182
bool hasTableForSorting(Table *cmp_table) const
Definition position.h:128
TODO: Rename this file - func.h is stupid.