2 Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 package com.mysql.clusterj.core.query;
20 import com.mysql.clusterj.ClusterJException;
21 import com.mysql.clusterj.core.spi.QueryExecutionContext;
22 import com.mysql.clusterj.core.store.ScanFilter;
23 import com.mysql.clusterj.core.store.ScanOperation;
24 import com.mysql.clusterj.core.store.ScanFilter.Group;
26 public class NotPredicateImpl extends PredicateImpl {
28 /** The predicate being negated */
29 private PredicateImpl predicate;
31 public NotPredicateImpl(PredicateImpl predicate) {
32 super(predicate.dobj);
33 this.predicate = predicate;
37 public void markParameters() {
38 // Nothing to do because "not" can't use indexes
42 public void unmarkParameters() {
43 // Nothing to do because "not" can't use indexes
46 void markBoundsForCandidateIndices(QueryExecutionContext context,
47 CandidateIndexImpl[] candidateIndices) {
48 // Nothing to do because "not" can't use indexes
51 /** Create a filter for the operation. Call the negated predicate to set
53 * @param context the query execution context with the parameter values
54 * @param op the operation
56 public void filterCmpValue(QueryExecutionContext context,
59 ScanFilter filter = op.getScanFilter(context);
60 filter.begin(Group.GROUP_NAND);
61 predicate.filterCmpValue(context, op, filter);
63 } catch (ClusterJException ex) {
65 } catch (Exception ex) {
66 throw new ClusterJException(
67 local.message("ERR_Get_NdbFilter"), ex);
71 /** Use an existing filter for the operation. Call the negated predicate to set
73 * @param context the query execution context with the parameter values
74 * @param op the operation
75 * @param filter the existing filter
77 public void filterCmpValue(QueryExecutionContext context,
78 ScanOperation op, ScanFilter filter) {
80 filter.begin(Group.GROUP_NAND);
81 predicate.filterCmpValue(context, op, filter);
83 } catch (ClusterJException ex) {
85 } catch (Exception ex) {
86 throw new ClusterJException(
87 local.message("ERR_Get_NdbFilter"), ex);