Drizzled Public API Documentation

sargable_param.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 
41 {
42 public:
44  :
45  field(NULL),
46  arg_value(NULL),
47  num_values(0)
48  {}
49 
50  SargableParam(Field *in_field,
51  Item **in_arg_value,
52  uint32_t in_num_values)
53  :
54  field(in_field),
55  arg_value(in_arg_value),
56  num_values(in_num_values)
57  {}
58 
59  SargableParam(const SargableParam &rhs)
60  :
61  field(rhs.field),
62  arg_value(rhs.arg_value),
64  {}
65 
66  SargableParam &operator=(const SargableParam &rhs)
67  {
68  if (this == &rhs)
69  {
70  return *this;
71  }
72  field= rhs.field;
73  arg_value= rhs.arg_value;
75  return *this;
76  }
77 
78  Field *getField()
79  {
80  return field;
81  }
82 
83  uint32_t getNumValues() const
84  {
85  return num_values;
86  }
87 
88  bool isConstItem(uint32_t index)
89  {
90  return (arg_value[index]->const_item());
91  }
92 
93 private:
94 
99 
104 
108  uint32_t num_values;
109 };
110 
111 } /* end namespace optimizer */
112 
113 } /* end namespace drizzled */
114 
TODO: Rename this file - func.h is stupid.