1 21 22 package org.apache.derby.impl.store.access.sort; 23 24 import org.apache.derby.iapi.reference.SQLState; 25 26 import org.apache.derby.iapi.services.io.FormatableBitSet; 27 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 import org.apache.derby.iapi.services.io.Storable; 30 31 import org.apache.derby.iapi.error.StandardException; 32 33 import org.apache.derby.iapi.store.access.conglomerate.TransactionManager; 34 import org.apache.derby.iapi.store.access.RowUtil; 35 import org.apache.derby.iapi.store.access.ScanController; 36 37 import org.apache.derby.iapi.types.DataValueDescriptor; 38 39 40 45 46 public abstract class SortScan extends Scan 47 { 48 49 52 protected MergeSort sort = null; 53 54 57 protected TransactionManager tran = null; 58 59 63 protected DataValueDescriptor[] current; 64 65 69 protected boolean hold; 70 71 74 SortScan(MergeSort sort, TransactionManager tran, boolean hold) 75 { 76 super(); 77 this.sort = sort; 78 this.tran = tran; 79 this.hold = hold; 80 } 81 82 85 86 116 public final boolean fetchNext(DataValueDescriptor[] row) 117 throws StandardException 118 { 119 boolean ret_val = next(); 120 121 if (ret_val) 122 fetch(row); 123 124 return(ret_val); 125 } 126 127 131 public final void fetch(DataValueDescriptor[] result) 132 throws StandardException 133 { 134 if (SanityManager.DEBUG) 135 { 136 SanityManager.ASSERT(sort != null); 137 } 138 139 if (current == null) 140 { 141 throw StandardException.newException( 142 SQLState.SORT_SCAN_NOT_POSITIONED); 143 } 144 145 sort.checkColumnTypes(result); 147 148 153 System.arraycopy(current, 0, result, 0, result.length); 158 } 159 160 169 public final void fetchWithoutQualify(DataValueDescriptor[] result) 170 throws StandardException 171 { 172 throw StandardException.newException( 173 SQLState.SORT_IMPROPER_SCAN_METHOD); 174 175 } 176 177 180 public void close() 181 { 182 sort = null; 183 current = null; 184 185 tran.closeMe(this); 186 } 187 188 191 } 192 | Popular Tags |