MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ScanFilter.hpp
1
/*
2
Copyright (C) 2003-2006, 2008 MySQL AB, 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 SCAN_FILTER_HPP
20
#define SCAN_FILTER_HPP
21
22
/* NOTE - This code is currently broken, as old-style interpreted
23
* code definition is no longer supported for Scans.
24
* Interpreted programs for scans must be defined using the
25
* NdbInterpretedCode class
26
* TODO : Fix or remove this code.
27
*/
28
29
class
ScanFilter
{
30
public
:
31
#if 0
32
38
ScanFilter
(
const
NDBT_Table
& tab,
39
int
colNo,
40
int
val);
41
#endif
42
ScanFilter
(
int
records = 1000){};
43
virtual
~
ScanFilter
() {}
44
virtual
int
filterOp(
NdbOperation
*) = 0;
45
virtual
int
verifyRecord(
NDBT_ResultRow
&) = 0;
46
private
:
47
48
// const NDBT_Table& tab;
49
};
50
51
class
LessThanFilter
:
public
ScanFilter
{
52
public
:
53
LessThanFilter
(
int
records){ compare_value = records / 100; };
54
virtual
~
LessThanFilter
(){}
55
private
:
56
Uint32 compare_value;
57
int
filterOp(
NdbOperation
* pOp);
58
int
verifyRecord(
NDBT_ResultRow
&);
59
};
60
61
class
EqualFilter
:
public
ScanFilter
{
62
public
:
63
virtual
~
EqualFilter
(){}
64
65
static
const
Uint32 compare_value = 100;
66
int
filterOp(
NdbOperation
* pOp);
67
int
verifyRecord(
NDBT_ResultRow
&);
68
};
69
70
class
NoFilter
:
public
ScanFilter
{
71
public
:
72
virtual
~
NoFilter
(){}
73
int
filterOp(
NdbOperation
* pOp);
74
int
verifyRecord(
NDBT_ResultRow
&);
75
};
76
77
78
int
LessThanFilter::filterOp(
NdbOperation
* pOp){
79
80
if
(pOp->
load_const_u32
(1, compare_value) != 0)
81
return
NDBT_FAILED;
82
83
if
(pOp->
read_attr
(
"KOL2"
, 2) != 0)
84
return
NDBT_FAILED;
85
86
if
(pOp->branch_lt(1, 2, 0) != 0)
87
return
NDBT_FAILED;
88
89
if
(pOp->
interpret_exit_nok
() != 0)
90
return
NDBT_FAILED;
91
92
if
(pOp->
def_label
(0) != 0)
93
return
NDBT_FAILED;
94
95
if
(pOp->
interpret_exit_ok
() != 0)
96
return
NDBT_FAILED;
97
98
return
NDBT_OK;
99
}
100
101
int
LessThanFilter::verifyRecord(
NDBT_ResultRow
& row){
102
NdbRecAttr
*
rec
= row.attributeStore(1);
103
if
(rec->
u_32_value
() < compare_value)
104
return
NDBT_OK;
105
return
NDBT_FAILED;
106
}
107
108
int
EqualFilter::filterOp(
NdbOperation
* pOp){
109
110
if
(pOp->
load_const_u32
(1, compare_value) != 0)
111
return
NDBT_FAILED;
112
113
if
(pOp->
read_attr
(
"KOL2"
, 2) != 0)
114
return
NDBT_FAILED;
115
116
if
(pOp->branch_eq(1, 2, 0) != 0)
117
return
NDBT_FAILED;
118
119
if
(pOp->
interpret_exit_nok
() != 0)
120
return
NDBT_FAILED;
121
122
if
(pOp->
def_label
(0) != 0)
123
return
NDBT_FAILED;
124
125
if
(pOp->
interpret_exit_ok
() != 0)
126
return
NDBT_FAILED;
127
128
return
NDBT_OK;
129
}
130
131
int
EqualFilter::verifyRecord(
NDBT_ResultRow
& row){
132
NdbRecAttr
* rec = row.attributeStore(1);
133
if
(rec->
u_32_value
() == compare_value)
134
return
NDBT_OK;
135
return
NDBT_FAILED;
136
}
137
138
int
NoFilter::filterOp(
NdbOperation
* pOp){
139
return
NDBT_OK;
140
}
141
142
int
NoFilter::verifyRecord(
NDBT_ResultRow
& row){
143
// Check if this record should be in the result set or not
144
return
NDBT_OK;
145
}
146
147
#endif
storage
ndb
test
ndbapi
ScanFilter.hpp
Generated on Sat Nov 9 2013 01:28:21 for MySQL 5.6.14 Source Code Document by
1.8.1.2