1 package com.daffodilwoods.daffodildb.server.sql99.dql.iterator.table; 2 3 import com.daffodilwoods.daffodildb.server.datasystem.utility.*; 4 import com.daffodilwoods.daffodildb.server.sql99.common.*; 5 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 6 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 7 import com.daffodilwoods.daffodildb.utils.field.*; 8 import com.daffodilwoods.database.resource.*; 9 10 22 public class BaseIterator extends BaseExceptionSingleIterator implements _Iterator { 23 24 private TableDetails tableDetails; 25 private _Record record; 26 private int state = 2; 27 28 public BaseIterator(_Record record0, TableDetails tableDetails0) { 29 tableDetails = tableDetails0; 30 record = record0; 31 } 32 33 public TableDetails[] getTableDetails() throws DException { 34 return new TableDetails[] {tableDetails}; 35 } 36 37 public _Iterator getBaseIterator(ColumnDetails column) throws DException { 38 return this; 39 } 40 41 public void setConditionVariableValue(_Reference[] references, Object [] values, int priority) throws DException { 42 } 43 44 public Object getColumnValues() throws DException { 45 Object object = record.getObject(); 46 return object; 47 } 48 49 public _KeyColumnInformation[] getKeyColumnInformations() throws DException { 50 return new _KeyColumnInformation[0]; 51 } 52 53 public Object getColumnValues(_Reference[] reference) throws DException { 54 int length = reference.length; 55 Object [] result = new Object [length]; 56 for (int i = 0; i < length; i++) { 57 result[i] = record.getObject(reference[i].getColumn()); 58 } 59 return result; 60 } 61 62 public Object getColumnValues(_Reference reference) throws DException { 63 Object value = record.getObject(reference.getColumn()); 64 return value; 65 } 66 67 public boolean first() throws DException { 68 state = 0; 69 return true; 70 } 71 72 public boolean last() throws DException { 73 state = 0; 74 return true; 75 } 76 77 public boolean next() throws DException { 78 if (state == -1) { 79 state = 0; 80 return true; 81 } 82 if (state == 1) { 83 throw new DException("DSE3553", null); 84 } 85 state = 1; 86 return false; 87 } 88 89 public boolean previous() throws DException { 90 if (state == 1) { 91 state = 0; 92 return true; 93 } 94 if (state == -1) { 95 throw new DException("DSE3553", null); 96 } 97 state = -1; 98 return false; 99 } 100 101 public _Record getRecord() throws DException { 102 return (Record) record; 103 } 104 105 public String toString() { 106 return " BaseIterator "; 107 } 108 109 public FieldBase field(_Reference reference) throws com.daffodilwoods.database.resource.DException { 110 FieldBase value = (FieldBase) record.getObject(reference.getColumn()); 111 return value; 112 } 113 114 public FieldBase[] fields(_Reference[] references) throws com.daffodilwoods.database.resource.DException { 115 int length = references.length; 116 FieldBase[] result = new FieldBase[length]; 117 for (int i = 0; i < length; i++) { 118 result[i] = (FieldBase) record.getObject(references[i].getColumn()); 119 } 120 return result; 121 } 122 123 public FieldBase[] fields(int[] columns) throws com.daffodilwoods.database.resource.DException { 124 throw new java.lang.UnsupportedOperationException ("Method fields() not yet implemented."); 125 } 126 127 public void setSpecificUnderlyingReferences(_Reference[] specificUnderlyingReferences) throws DException{ 128 } 129 130 public void releaseResource() throws DException { 131 } 132 } 133 | Popular Tags |