Drizzled Public API Documentation

key_use.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 namespace drizzled
23 {
24 namespace optimizer
25 {
26 
27 class KeyUse
28 {
29 public:
30 
31  KeyUse()
32  :
33  table(NULL),
34  val(NULL),
35  used_tables(0),
36  key(0),
37  keypart(0),
38  optimize(0),
39  keypart_map(0),
40  ref_table_rows(0),
41  null_rejecting(false),
42  cond_guard(NULL)
43  {}
44 
45  KeyUse(Table *in_table,
46  Item *in_val,
47  table_map in_used_tables,
48  uint32_t in_key,
49  uint32_t in_keypart,
50  uint32_t in_optimize,
51  key_part_map in_keypart_map,
52  ha_rows in_ref_table_rows,
53  bool in_null_rejecting,
54  bool *in_cond_guard)
55  :
56  table(in_table),
57  val(in_val),
58  used_tables(in_used_tables),
59  key(in_key),
60  keypart(in_keypart),
61  optimize(in_optimize),
62  keypart_map(in_keypart_map),
63  ref_table_rows(in_ref_table_rows),
64  null_rejecting(in_null_rejecting),
65  cond_guard(in_cond_guard)
66  {}
67 
68  Table *getTable()
69  {
70  return table;
71  }
72 
73  Item *getVal()
74  {
75  return val;
76  }
77 
78  table_map getUsedTables() const
79  {
80  return used_tables;
81  }
82 
83  uint32_t getKey() const
84  {
85  return key;
86  }
87 
88  uint32_t getKeypart() const
89  {
90  return keypart;
91  }
92 
93  uint32_t getOptimizeFlags() const
94  {
95  return optimize;
96  }
97 
98  key_part_map getKeypartMap() const
99  {
100  return keypart_map;
101  }
102 
103  ha_rows getTableRows() const
104  {
105  return ref_table_rows;
106  }
107 
108  void setTableRows(ha_rows input)
109  {
110  ref_table_rows= input;
111  }
112 
113  bool isNullRejected() const
114  {
115  return null_rejecting;
116  }
117 
118  bool *getConditionalGuard()
119  {
120  return cond_guard;
121  }
122 
123 private:
124 
129  table_map used_tables;
130 
131  uint32_t key;
132 
133  uint32_t keypart;
134 
135  uint32_t optimize;
137  key_part_map keypart_map;
138 
139  ha_rows ref_table_rows;
140 
146 
157  bool *cond_guard;
158 };
159 
160 } /* end namespace optimizer */
161 
162 } /* end namespace drizzled */
163