MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbScanFilter.hpp
1 /*
2  Copyright (C) 2003-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef NDB_SCAN_FILTER_HPP
20 #define NDB_SCAN_FILTER_HPP
21 
22 #include <ndb_types.h>
23 #include "ndbapi_limits.h"
24 
25 #include "NdbInterpretedCode.hpp"
26 
36 public:
52 
70  NdbScanFilter(class NdbOperation * op);
71 
72  ~NdbScanFilter();
73 
77  enum Group {
78  AND = 1,
79  OR = 2,
80  NAND = 3,
81  NOR = 4
82  };
83 
85  {
86  COND_LE = 0,
87  COND_LT = 1,
88  COND_GE = 2,
89  COND_GT = 3,
90  COND_EQ = 4,
91  COND_NE = 5,
92  COND_LIKE = 6,
98  };
99 
110  int begin(Group group = AND);
111 
116  int end();
117 
124  int istrue();
125 
130  int isfalse();
131 
146  int cmp(BinaryCondition cond, int ColId, const void *val, Uint32 len = 0);
147 
155  int eq(int ColId, Uint32 value) { return cmp(COND_EQ, ColId, &value, 4);}
156 
160  int ne(int ColId, Uint32 value) { return cmp(COND_NE, ColId, &value, 4);}
164  int lt(int ColId, Uint32 value) { return cmp(COND_LT, ColId, &value, 4);}
168  int le(int ColId, Uint32 value) { return cmp(COND_LE, ColId, &value, 4);}
172  int gt(int ColId, Uint32 value) { return cmp(COND_GT, ColId, &value, 4);}
176  int ge(int ColId, Uint32 value) { return cmp(COND_GE, ColId, &value, 4);}
177 
181  int eq(int ColId, Uint64 value) { return cmp(COND_EQ, ColId, &value, 8);}
185  int ne(int ColId, Uint64 value) { return cmp(COND_NE, ColId, &value, 8);}
189  int lt(int ColId, Uint64 value) { return cmp(COND_LT, ColId, &value, 8);}
193  int le(int ColId, Uint64 value) { return cmp(COND_LE, ColId, &value, 8);}
197  int gt(int ColId, Uint64 value) { return cmp(COND_GT, ColId, &value, 8);}
201  int ge(int ColId, Uint64 value) { return cmp(COND_GE, ColId, &value, 8);}
207  int isnull(int ColId);
211  int isnotnull(int ColId);
212 
213  enum Error {
214  FilterTooLarge = 4294
215  };
216 
224  const struct NdbError & getNdbError() const;
225 
231  const NdbInterpretedCode* getInterpretedCode() const;
232 
241  NdbOperation * getNdbOperation() const;
242 private:
243 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
244  friend class NdbScanFilterImpl;
245 #endif
246  class NdbScanFilterImpl & m_impl;
247  NdbScanFilter& operator=(const NdbScanFilter&);
248 };
249 
250 #endif