1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.sql.Activation; 25 26 import org.apache.derby.iapi.error.StandardException; 27 28 import org.apache.derby.iapi.store.access.Qualifier; 29 30 import org.apache.derby.iapi.types.DataValueDescriptor; 31 32 import org.apache.derby.iapi.services.loader.GeneratedMethod; 33 34 import org.apache.derby.iapi.services.sanity.SanityManager; 35 36 41 42 public class GenericQualifier implements Qualifier 43 { 44 private int columnId; 45 private int operator; 46 private GeneratedMethod orderableGetter; 47 private Activation activation; 48 private boolean orderedNulls; 49 private boolean unknownRV; 50 private boolean negateCompareResult; 51 protected int variantType; 52 53 private DataValueDescriptor orderableCache = null; 54 55 public GenericQualifier(int columnId, 56 int operator, 57 GeneratedMethod orderableGetter, 58 Activation activation, 59 boolean orderedNulls, 60 boolean unknownRV, 61 boolean negateCompareResult, 62 int variantType) 63 { 64 this.columnId = columnId; 65 this.operator = operator; 66 this.orderableGetter = orderableGetter; 67 this.activation = activation; 68 this.orderedNulls = orderedNulls; 69 this.unknownRV = unknownRV; 70 this.negateCompareResult = negateCompareResult; 71 this.variantType = variantType; 72 } 73 74 77 78 81 public int getColumnId() 82 { 83 return columnId; 84 } 85 86 91 public DataValueDescriptor getOrderable() throws StandardException 92 { 93 if (variantType != VARIANT) 94 { 95 if (orderableCache == null) 96 { 97 orderableCache = (DataValueDescriptor) (orderableGetter.invoke(activation)); 98 } 99 return orderableCache; 100 } 101 return (DataValueDescriptor) (orderableGetter.invoke(activation)); 102 } 103 104 108 public int getOperator() 109 { 110 return operator; 111 } 112 113 118 public boolean negateCompareResult() 119 { 120 return negateCompareResult; 121 } 122 123 127 public boolean getOrderedNulls() 128 { 129 return orderedNulls; 130 } 131 132 136 public boolean getUnknownRV() 137 { 138 return unknownRV; 139 } 140 141 153 public void clearOrderableCache() 154 { 155 if ((variantType == SCAN_INVARIANT) || (variantType == VARIANT)) 156 { 157 orderableCache = null; 158 } 159 } 160 161 172 public void reinitialize() 173 { 174 if (variantType != CONSTANT) 175 { 176 orderableCache = null; 177 } 178 } 179 180 public String toString() 181 { 182 if (SanityManager.DEBUG) 183 { 184 return "columnId: "+columnId+ 185 "\noperator: "+operator+ 186 "\norderedNulls: "+orderedNulls+ 187 "\nunknownRV: "+unknownRV+ 188 "\nnegateCompareResult: "+negateCompareResult; 189 } 190 else 191 { 192 return ""; 193 } 194 } 195 } 196 | Popular Tags |