1 package com.daffodilwoods.daffodildb.server.sql99.dql.plan.table; 2 3 import com.daffodilwoods.daffodildb.client.*; 4 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 5 import com.daffodilwoods.daffodildb.server.datasystem.utility._Record; 6 import com.daffodilwoods.daffodildb.server.sql99.common.*; 7 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*; 8 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dql.resultsetmetadata.*; 11 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 12 import com.daffodilwoods.daffodildb.utils.*; 13 import com.daffodilwoods.daffodildb.utils.field.*; 14 import com.daffodilwoods.database.resource.*; 15 import com.daffodilwoods.database.sqlinitiator.*; 16 import com.daffodilwoods.database.utility.P; 17 18 32 public class Executer implements _SelectQueryIterator { 33 34 37 38 private _Iterator iterator; 39 40 43 44 private _SelectQueryIterator selectIterator; 45 46 50 51 private boolean firstTime; 52 53 public Executer(_Iterator iterator0, TableDetails[] tableDetails0, _TablePlan tablePlan0) { 54 iterator = iterator0; 55 selectIterator = (_SelectQueryIterator) iterator0; 56 firstTime = false; 57 } 58 59 public Object [][] getFunctionalColumnMapping() throws DException { 60 return iterator.getFunctionalColumnMapping(); 61 } 62 63 public _OrderCount getOrderCounts() throws DException { 64 return iterator.getOrderCounts(); 65 } 66 67 public TableDetails[] getTableDetails() throws DException { 68 return iterator.getTableDetails(); 69 } 70 71 public _Iterator getBaseIterator(ColumnDetails column) throws DException { 72 return iterator.getBaseIterator(column); 73 } 74 75 public void setConditionVariableValue(_Reference[] references, Object [] values, int priority) throws DException { 76 if (firstTime) { 77 releaseResource(); 78 GeneralPurposeStaticClass.initiateSetConditionVariableValues(iterator, references, values, priority); 79 } else { 80 iterator.setConditionVariableValue(references, values, priority); 81 } 82 firstTime = true; 83 } 84 85 public void setKeyCount(Object [][] tableAndKeyCount) throws DException { 86 iterator.setKeyCount(tableAndKeyCount); 87 } 88 89 public Object getColumnValues() throws DException { 90 return iterator.getColumnValues(); 91 } 92 93 public _KeyColumnInformation[] getKeyColumnInformations() throws DException { 94 return iterator.getKeyColumnInformations(); 95 } 96 97 public Object [] getUniqueColumnReference() throws DException { 98 return iterator.getUniqueColumnReference(); 99 } 100 101 public boolean seek(Object indexKey) throws DException { 102 return iterator.seek(indexKey); 103 } 104 105 public _Order getDefaultOrder() throws DException { 106 return iterator.getDefaultOrder(); 107 } 108 109 public _ExecutionPlan getExecutionPlan() throws DException { 110 return iterator.getExecutionPlan(); 111 } 112 113 114 public Object getColumnValues(_Reference[] reference) throws DException { 115 return iterator.getColumnValues(reference); 116 } 117 118 public Object getColumnValues(_Reference reference) throws DException { 119 return iterator.getColumnValues(reference); 120 } 121 122 public boolean seekFromTop(_IndexPredicate[] condition) throws DException { 123 return iterator.seekFromTop(condition); 124 } 125 126 public boolean seekFromTopRelative(Object indexKey) throws DException { 127 return iterator.seekFromTopRelative(indexKey); 128 } 129 130 public boolean seekFromBottom(_IndexPredicate[] condition) throws DException { 131 return iterator.seekFromBottom(condition); 132 } 133 134 public boolean seekFromBottomRelative(Object indexKey) throws DException { 135 return iterator.seekFromBottomRelative(indexKey); 136 } 137 138 public boolean first() throws DException { 139 return iterator.first(); 140 } 141 142 public boolean last() throws DException { 143 return iterator.last(); 144 } 145 146 public boolean next() throws DException { 147 return iterator.next(); 148 } 149 150 public boolean previous() throws DException { 151 return iterator.previous(); 152 } 153 154 public Object getKey() throws DException { 155 return iterator.getKey(); 156 } 157 158 public void moveToRow(Object key) throws DException { 159 Object [] keys = convertIntoFields(key); 160 iterator.move(keys); 161 } 162 163 public void move(Object key) throws DException { 164 moveToRow(key); 165 } 166 167 private Object [] convertIntoFields(Object key) throws DException { 168 FieldBase[] fieldBase ; 169 171 Object [] tmpKey = (Object [])key; 172 if(!(tmpKey[0] instanceof FieldBase)) 173 fieldBase = FieldUtility.getFields( (Object []) key); 174 else{ 175 fieldBase = new FieldBase[tmpKey.length]; 176 for (int i = 0; i < tmpKey.length; i++) { 177 fieldBase[i] =(FieldBase)tmpKey[i]; 178 } 179 } 180 181 182 _KeyColumnInformation[] keyColumns = iterator.getKeyColumnInformations(); 183 int length = keyColumns.length; 184 FieldBase[] result = new FieldBase[length]; 185 for (int i = 0; i < length; i++) { 186 ColumnDetails cd = keyColumns[i].getColumnDetails(); 187 result[i] = FieldUtility.convertToAppropriateType(fieldBase[i], 188 cd.getDatatype(),cd.getSize(), cd.getTable().getColumnCharacteristics().getCollator()); 189 } 190 return result; 191 } 192 193 public Object getColumnValues(int[] columns) throws DException { 194 return iterator.getColumnValues(columns); 195 } 196 197 public _Record getRecord() throws DException { 198 return iterator.getRecord(); 199 } 200 201 public Object getColumnValueForReference(_Reference reference) throws DException { 202 return selectIterator.getColumnValueForReference(reference); 203 } 204 205 public _ColumnCharacteristics getColumnCharacteristics() throws DException { 206 return selectIterator.getColumnCharacteristics(); 207 } 208 209 public _RowReader getRowReader() throws DException { 210 return selectIterator.getRowReader(); 211 } 212 213 public void beforeFirst() throws DException { 214 selectIterator.beforeFirst(); 215 } 216 217 public Object [] fetchForward(int rowCount) throws DException { 218 return selectIterator.fetchForward(rowCount); 219 } 220 221 public void afterLast() throws DException { 222 selectIterator.afterLast(); 223 } 224 225 public Object [] fetchBackward(int rowCount) throws DException { 226 return selectIterator.fetchBackward(rowCount); 227 } 228 229 public int move(int rowCount) throws DException { 230 return selectIterator.move(rowCount); 231 } 232 233 public _SelectColumnCharacteristics getSelectColumnCharacteristics() throws DException { 234 return selectIterator.getSelectColumnCharacteristics(); 235 } 236 237 public int getRowCount() throws DException { 238 return selectIterator.getRowCount(); 239 } 240 241 public Object insert(int[] columnIndexes, Object [] columnValues) throws DException { 242 return selectIterator.insert(columnIndexes, columnValues); 243 } 244 245 public Object update(Object key, int[] columnIndexes, Object [] values, Object row) throws DException { 246 Object [] keys = convertIntoFields(key); 247 return selectIterator.update(keys, columnIndexes, values, row); 248 } 249 250 public void delete(Object key) throws DException { 251 Object [] keys = convertIntoFields(key); 252 selectIterator.delete(keys); 253 } 254 255 public Object moveToInsertRow() throws DException { 256 return selectIterator.moveToInsertRow(); 257 } 258 259 public _QueryPlan getQueryPlan() throws DException { 260 return selectIterator.getQueryPlan(); 261 } 262 263 public Object getSelectColumnValues() throws DException { 264 return selectIterator.getSelectColumnValues(); 265 } 266 267 public void flushInsertedRecord() throws DException { 268 selectIterator.flushInsertedRecord(); 269 } 270 271 public void setType(int parm1) throws com.daffodilwoods.database.resource.DException { 272 throw new UnsupportedOperationException ("Method not implemented"); 273 } 274 275 public String toString() { 276 return iterator.toString(); 277 } 278 279 public ExecutionPlanForBrowser getExecutionPlanForBrowser() throws DException { 280 return iterator.getExecutionPlanForBrowser(); 281 } 282 283 public _Iterator getBaseIteratorHasRecord(ColumnDetails parm1) throws com.daffodilwoods.database.resource.DException { 284 285 throw new java.lang.UnsupportedOperationException ("Method getBaseIterator() not yet implemented."); 286 } 287 288 public FieldBase field(_Reference reference) throws com.daffodilwoods.database.resource.DException { 289 return iterator.field(reference); 290 } 291 292 public FieldBase[] fields(_Reference[] references) throws com.daffodilwoods.database.resource.DException { 293 return iterator.fields(references); 294 } 295 296 public FieldBase[] fields(int[] columns) throws com.daffodilwoods.database.resource.DException { 297 throw new java.lang.UnsupportedOperationException ("Method fields() not yet implemented."); 298 } 299 300 public Object getObject() throws DException { 301 return selectIterator.getObject(); 302 } 303 304 public FieldBase getFieldValueForReference(_Reference reference) throws DException { 305 return iterator.field(reference); 306 } 307 308 public void releaseResource() throws DException { 309 iterator.releaseResource(); 310 } 311 312 public boolean isUpdatable() throws DException { 313 return selectIterator.isUpdatable(); 314 } 315 316 public int[] getDataTypes() throws DException { 317 return selectIterator.getDataTypes(); 318 } 319 320 public byte[] getByteKey() throws DException{ 321 throw new java.lang.UnsupportedOperationException ( 322 "Method getByteKey() not yet implemented."); 323 } 324 public void moveByteKey(byte[] key) throws DException{ 325 throw new java.lang.UnsupportedOperationException ( 326 "Method moveByteKey() not yet implemented."); 327 } 328 329 public void setSpecificUnderlyingReferences(_Reference[] specificUnderlyingReferences) throws DException{ 330 throw new java.lang.UnsupportedOperationException ( 331 "Method setSpecificUnderlyingReferences() not yet implemented."); 332 } 333 334 } 335 | Popular Tags |