1 package com.daffodilwoods.daffodildb.server.sessionsystem; 2 3 import java.util.*; 4 5 6 import com.daffodilwoods.daffodildb.client.*; 7 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 8 import com.daffodilwoods.daffodildb.server.datasystem.utility._Record; 9 import com.daffodilwoods.daffodildb.server.sessionsystem.sessioncondition.*; 10 import com.daffodilwoods.daffodildb.server.sql99.common.*; 11 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*; 12 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 13 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 14 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 15 import com.daffodilwoods.daffodildb.utils.comparator.*; 16 import com.daffodilwoods.daffodildb.utils.field.*; 17 import com.daffodilwoods.database.resource.*; 18 import com.daffodilwoods.database.sqlinitiator.*; 19 public class NonIndexedSessionFilterIterator extends BaseExceptionSingleIterator 20 implements _Iterator, _TableOperations, _UserTableOperations, _IndexIteratorInfo{ 21 22 _Iterator nonIndexedIterator; 23 _SessionCondition condition; 24 int [] columnIndexes,backUpColumnIndexes; 25 int status = -1; 26 27 public NonIndexedSessionFilterIterator(_Iterator nonIndexedIterator0 , _SessionCondition condition0) { 28 this.nonIndexedIterator = nonIndexedIterator0; 29 condition = condition0; 30 try { 31 columnIndexes = (int[])(nonIndexedIterator.getUniqueColumnReference())[0]; 32 backUpColumnIndexes = columnIndexes; 33 } 34 catch (Exception ex) { 35 } 36 } 37 38 39 public boolean first() throws DException { 40 try{ 41 42 if(!nonIndexedIterator.first()){ 43 status = -1; 44 return false; 45 } 46 47 48 49 while(!condition.evaluate(nonIndexedIterator)){ 50 if(!nonIndexedIterator.next()) { 51 status = -1; 52 return false; 53 } 54 55 } 56 }catch(DException ex) { 57 if(ex.getDseCode().equalsIgnoreCase("DSE2004" )){ 58 return next(); 59 } 60 throw ex; 61 } 62 status = 0; 63 return true; 64 } 65 66 public void setKeyCount(Object [][] tableAndKeyCount) throws DException { 67 68 throw new java.lang.UnsupportedOperationException ("Method setKeyCount() not yet implemented."); 69 } 70 71 public boolean last() throws DException { 72 try{ 73 if(!nonIndexedIterator.last()){ 74 status = -1; 75 return false; 76 } 77 while(!condition.evaluate(nonIndexedIterator)){ 78 if(!nonIndexedIterator.previous()){ 79 status = -1; 80 return false; 81 } 82 } 83 }catch(DException ex) { 84 if(ex.getDseCode().equalsIgnoreCase("DSE2004" )) 85 return previous(); 86 throw ex; 87 } 88 status = 0; 89 return true; 90 } 91 92 public boolean next() throws DException { 93 try{ 94 do{ 95 if(!nonIndexedIterator.next()){ 96 status = -1; 97 return false; 98 } 99 100 }while(!condition.evaluate(nonIndexedIterator)); 101 }catch(DException ex) { 102 if(ex.getDseCode().equalsIgnoreCase("DSE2004" )) 103 return next(); 104 throw ex; 105 } 106 status = 0; 107 return true; 108 } 109 110 public boolean previous() throws DException { 111 boolean result ; 112 try{ 113 do{ 114 if(!nonIndexedIterator.previous()){ 115 status = -1; 116 return false; 117 } 118 result = condition.evaluate(nonIndexedIterator); 119 }while(!result); 120 }catch(DException ex) { 121 if(ex.getDseCode().equalsIgnoreCase("DSE2004" )) 122 return previous(); 123 throw ex; 124 } 125 status = 0; 126 return true; 127 } 128 129 public boolean seekFromTop(booleanvalueexpression condition) throws DException{ 130 throw new UnsupportedOperationException (); 131 } 132 133 public boolean seekFromBottom(booleanvalueexpression condition) throws DException{ 134 throw new UnsupportedOperationException (); 135 } 136 137 public Object getColumnValues(_Reference[] leftColumnReferences) throws DException { 138 return nonIndexedIterator.getColumnValues(leftColumnReferences); 139 } 140 141 public String toString(){ 142 String str= "Non_Index_Session_FilterIterator["; 143 str += nonIndexedIterator +" "; 144 str += nonIndexedIterator.getClass()+" "; 145 str += condition.toString() + "]"; 146 return str; 147 } 148 149 public void setConditionVariableValue(_Reference[] references , Object [] values, int priority) throws DException{ 150 try{ 151 nonIndexedIterator.setConditionVariableValue(references, values, priority); 152 }catch(Exception E){ 153 } 154 } 155 public boolean seekFromBottomAbsolute(_IndexPredicate parm1) throws com.daffodilwoods.database.resource.DException { 156 return nonIndexedIterator.seekFromBottomRelative(parm1); 157 } 158 159 public boolean seekFromBottomRelative(Object indexKey) throws com.daffodilwoods.database.resource.DException { 160 return nonIndexedIterator.seekFromBottomRelative(indexKey); 161 } 162 163 public Object getKey() throws com.daffodilwoods.database.resource.DException { 164 return nonIndexedIterator.getColumnValues(columnIndexes); 165 } 166 public void move(Object key) throws com.daffodilwoods.database.resource.DException { 167 if(! nonIndexedIterator.seek(key)){ 168 throw new DException("DSE5528", null); 169 } 170 } 171 public Object getColumnValues(int[] parm1) throws com.daffodilwoods.database.resource.DException { 172 return nonIndexedIterator.getColumnValues(parm1); 173 } 174 public _Record getRecord() throws com.daffodilwoods.database.resource.DException { 175 return nonIndexedIterator.getRecord(); 176 } 177 public Object getColumnValues() throws DException{ 178 return nonIndexedIterator.getColumnValues(); 179 } 180 181 public void insert(Object parm1) throws com.daffodilwoods.database.resource.DException { 182 ((_TableOperations)nonIndexedIterator).insert(parm1); 183 } 184 public void update(Object parm1) throws com.daffodilwoods.database.resource.DException { 185 ((_TableOperations)nonIndexedIterator).update(parm1); 186 } 187 public void update(int[] parm1, Object [] parm2) throws com.daffodilwoods.database.resource.DException { 188 ((_TableOperations)nonIndexedIterator).update(parm1,parm2); 189 } 190 public void delete() throws com.daffodilwoods.database.resource.DException { 191 ((_TableOperations)nonIndexedIterator).delete(); 192 } 193 public void insert(_DatabaseUser parm1, Object parm2) throws com.daffodilwoods.database.resource.DException { 194 ((_UserTableOperations)nonIndexedIterator).insert(parm1,parm2); 195 } 196 public void update(_DatabaseUser parm1, Object parm2) throws com.daffodilwoods.database.resource.DException { 197 ((_UserTableOperations)nonIndexedIterator).update(parm1,parm2); 198 } 199 public void update(_DatabaseUser parm1, int[] parm2, Object [] parm3) throws com.daffodilwoods.database.resource.DException { 200 ((_UserTableOperations)nonIndexedIterator).update(parm1,parm2,parm3); 201 } 202 public void delete(_DatabaseUser parm1) throws com.daffodilwoods.database.resource.DException { 203 ((_UserTableOperations)nonIndexedIterator).delete(parm1); 204 } 205 public TableDetails[] getTableDetails() throws com.daffodilwoods.database.resource.DException { 206 return nonIndexedIterator.getTableDetails(); 207 } 208 public _Iterator getBaseIterator(ColumnDetails column) throws com.daffodilwoods.database.resource.DException { 209 return nonIndexedIterator.getBaseIterator(column); 210 } 211 212 public void setIterator(_Iterator iterator) throws DException { 213 214 throw new java.lang.UnsupportedOperationException ("Method setIterator() not yet implemented."); 215 } 216 217 public _KeyColumnInformation[] getKeyColumnInformations() throws DException { 218 return nonIndexedIterator.getKeyColumnInformations(); 219 } 220 221 public Object [] getUniqueColumnReference() throws DException { 222 try { 223 return nonIndexedIterator.getUniqueColumnReference(); 224 } 225 catch (UnsupportedOperationException ex) { 226 throw ex; 227 } 228 } 229 230 public boolean seek(Object indexKey) throws DException { 231 boolean flag = false; 232 try { 233 flag = nonIndexedIterator.seek(indexKey); 234 } 235 catch (Exception ex) { 236 } 237 return flag; 238 } 239 public boolean seekFromTop(_IndexPredicate []parm1) throws com.daffodilwoods.database.resource.DException { 240 return nonIndexedIterator.seekFromTop(parm1); 241 } 242 public boolean seekFromBottom(_IndexPredicate []parm1) throws com.daffodilwoods.database.resource.DException { 243 return nonIndexedIterator.seekFromBottom(parm1); 244 } 245 public boolean seekFromTopRelative(Object indexKey) throws com.daffodilwoods.database.resource.DException { 246 return nonIndexedIterator.seekFromTopRelative(indexKey); 247 } 248 249 public Object getColumnValues(_Reference references) throws DException { 250 return nonIndexedIterator.getColumnValues(references); 251 } 252 253 public int getBtreeIndex() throws com.daffodilwoods.database.resource.DException { 254 return ((_IndexIteratorInfo)nonIndexedIterator).getBtreeIndex(); 255 } 256 257 public _OrderCount getOrderCounts() throws DException { 258 259 return nonIndexedIterator.getOrderCounts(); 260 } 261 262 public Object [][] getReferenceAndValuePair() throws DException { 263 throw new java.lang.UnsupportedOperationException ("Method getReferences() not yet implemented."); 264 } 265 public _Order getDefaultOrder() throws DException{ 266 return nonIndexedIterator.getDefaultOrder(); 267 } 268 269 public boolean locateKey(Object parm1, boolean parm2) throws com.daffodilwoods.database.resource.DException { 270 if( ((_IndexIteratorInfo)nonIndexedIterator).locateKey(parm1,parm2)) 271 return (!condition.evaluate(nonIndexedIterator)) ? 272 parm2 ? next() : previous() : true; 273 return false; 274 } 275 276 public void ensureRecordInMemory() throws com.daffodilwoods.database.resource.DException { 277 ((_IndexIteratorInfo)nonIndexedIterator).ensureRecordInMemory(); 278 } 279 public void moveOnActualKey(Object parm1) throws com.daffodilwoods.database.resource.DException { 280 ((_IndexIteratorInfo)nonIndexedIterator).moveOnActualKey(parm1); 281 } 282 public Object getActualKey() throws com.daffodilwoods.database.resource.DException { 283 return status == -1 ? null : nonIndexedIterator.getKey(); 284 } 285 286 public _ExecutionPlan getExecutionPlan() throws DException{ 287 _ExecutionPlan cplan = nonIndexedIterator.getExecutionPlan(); 288 _ExecutionPlan cplans[] = cplan == null ? null : new _ExecutionPlan[]{cplan}; 289 ExecutionPlan plan = new ExecutionPlan("NonIndexedFilterIterator",cplans,""+condition,null,null); 290 return plan; 291 } 292 public boolean seekKeyAddress(Object parm1) throws com.daffodilwoods.database.resource.DException { 293 294 throw new java.lang.UnsupportedOperationException ("Method seekKeyAddress() not yet implemented."); 295 } 296 public Object getPhysicalAddress() throws com.daffodilwoods.database.resource.DException { 297 298 throw new java.lang.UnsupportedOperationException ("Method getPhysicalAddress() not yet implemented."); 299 } 300 301 public ExecutionPlanForBrowser getExecutionPlanForBrowser() throws DException { 302 return nonIndexedIterator.getExecutionPlanForBrowser(); 303 } 304 public SuperComparator getComparator() { 305 return ((_IndexIteratorInfo)nonIndexedIterator).getComparator(); 306 } 307 public SuperComparator getObjectComparator() throws com.daffodilwoods.database.resource.DException { 308 return ((_IndexIteratorInfo)nonIndexedIterator).getObjectComparator(); 309 } 310 public _Iterator getBaseIteratorHasRecord(ColumnDetails hasRecordColumn) throws DException { 311 throw new DException("DSE565",new Object []{"getBaseIterator"}); 312 } 313 public FieldBase field(_Reference reference) throws com.daffodilwoods.database.resource.DException { 314 return nonIndexedIterator.field(reference); 315 } 316 public FieldBase[] fields(_Reference[] references) throws com.daffodilwoods.database.resource.DException { 317 return nonIndexedIterator.fields(references); 318 } 319 public FieldBase[] fields(int[] columns) throws com.daffodilwoods.database.resource.DException { 320 return nonIndexedIterator.fields(columns); 321 } 322 public void releaseResource() throws DException { 323 nonIndexedIterator.releaseResource(); 324 } 325 326 public void deleteBlobClobRecord(_DatabaseUser user) throws com.daffodilwoods.database.resource.DException { 327 ((_TableOperations)nonIndexedIterator).deleteBlobClobRecord(user) ; 328 } 329 330 331 332 333 } 334 | Popular Tags |