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