|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.store.access.sort.Scan
org.apache.derby.impl.store.access.sort.SortBufferRowSource
public class SortBufferRowSource
Wrapping the output of a SortBuffer in a RowSource for the benefit of the createAndLoadConglomerate and loadConglomerate interface. Scan implements ScanController, this class just implements the RowSource interface.
| Field Summary | |
|---|---|
private int |
maxFreeListSize
|
(package private) SortBuffer |
sortBuffer
The Sort buffer where rows come from |
private SortObserver |
sortObserver
|
protected TransactionManager |
tran
The TransactionManager that opened this scan. |
private boolean |
writingToDisk
|
| Fields inherited from interface org.apache.derby.iapi.store.access.ScanController |
|---|
GE, GT, NA |
| Constructor Summary | |
|---|---|
SortBufferRowSource(SortBuffer sortBuffer,
TransactionManager tran,
SortObserver sortObserver,
boolean writingToDisk,
int maxFreeListSize)
|
|
| Method Summary | |
|---|---|
void |
close()
Close the scan |
boolean |
closeForEndTransaction(boolean closeHeldScan)
Close the scan |
void |
closeRowSource()
Close the rowSource |
void |
fetch(DataValueDescriptor[] result)
Fetch the row at the current position of the Scan. |
boolean |
fetchNext(DataValueDescriptor[] row)
Fetch the (partial) row at the next position of the Scan. |
void |
fetchWithoutQualify(DataValueDescriptor[] result)
Fetch the row at the current position of the Scan and does not apply the qualifiers. |
DataValueDescriptor[] |
getNextRowFromRowSource()
Get the next row as an array of column objects. |
FormatableBitSet |
getValidColumns()
All columns are always set from a sorter |
boolean |
needsRowLocation()
needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource. |
boolean |
needsToClone()
Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. |
boolean |
next()
Move to the next position in the scan. |
void |
rowLocation(RowLocation rl)
rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. |
| Methods inherited from class org.apache.derby.impl.store.access.sort.Scan |
|---|
delete, didNotQualify, doesCurrentPositionQualify, fetchLocation, fetchNextGroup, fetchNextGroup, fetchSet, getAllScanInfo, getEstimatedRowCount, getScanInfo, isCurrentPositionDeleted, isHeldAfterCommit, isKeyed, isTableLocked, newRowLocationTemplate, positionAtRowLocation, reopenScan, reopenScanByRowLocation, replace, setEstimatedRowCount |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.store.access.ScanController |
|---|
delete, didNotQualify, doesCurrentPositionQualify, fetchLocation, isCurrentPositionDeleted, isHeldAfterCommit, positionAtRowLocation, replace |
| Methods inherited from interface org.apache.derby.iapi.store.access.GenericScanController |
|---|
getScanInfo, isKeyed, isTableLocked, newRowLocationTemplate, reopenScan, reopenScanByRowLocation |
| Methods inherited from interface org.apache.derby.iapi.store.access.RowCountable |
|---|
getEstimatedRowCount, setEstimatedRowCount |
| Field Detail |
|---|
SortBuffer sortBuffer
protected TransactionManager tran
private int maxFreeListSize
private boolean writingToDisk
private SortObserver sortObserver
| Constructor Detail |
|---|
SortBufferRowSource(SortBuffer sortBuffer,
TransactionManager tran,
SortObserver sortObserver,
boolean writingToDisk,
int maxFreeListSize)
| Method Detail |
|---|
public DataValueDescriptor[] getNextRowFromRowSource()
RowSourceA null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.
If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.
If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().
getNextRowFromRowSource in interface RowSourcepublic boolean needsRowLocation()
RowLocationRetRowSource
needsRowLocation in interface RowLocationRetRowSourceRowLocationRetRowSource.rowLocation(org.apache.derby.iapi.types.RowLocation)public boolean needsToClone()
RowSource
needsToClone in interface RowSourceRowSource.needsToClone()public void rowLocation(RowLocation rl)
RowLocationRetRowSource
boolean needsRL = rowSource.needsRowLocation();
DataValueDescriptor[] row;
while((row = rowSource.getNextRowFromRowSource()) != null)
{
RowLocation rl = heapConglomerate.insertRow(row);
if (needsRL)
rowSource.rowLocation(rl);
}
rowLocation in interface RowLocationRetRowSourcepublic FormatableBitSet getValidColumns()
getValidColumns in interface RowSourcepublic void close()
close in interface GenericScanControllerpublic boolean closeForEndTransaction(boolean closeHeldScan)
closeForEndTransaction in interface ScanManagercloseHeldScan - If true, means to close scan even if it has been
opened to be kept opened across commit. This is
used to close these scans on abort.
public void closeRowSource()
closeRowSource in interface RowSource
public boolean next()
throws StandardException
ScanController
next in interface GroupFetchScanControllernext in interface ScanControllerStandardException - Standard exception policy.
public void fetchWithoutQualify(DataValueDescriptor[] result)
throws StandardException
fetchWithoutQualify in interface ScanControllerresult - The row into which the value of the current
position in the scan is to be stored.
StandardException - Standard exception policy.ScanController.fetchWithoutQualify(org.apache.derby.iapi.types.DataValueDescriptor[])
public void fetch(DataValueDescriptor[] result)
throws StandardException
fetch in interface ScanControllerresult - The row into which the value of the current
position in the scan is to be stored.
StandardException - Standard exception policy.ScanController.fetch(org.apache.derby.iapi.types.DataValueDescriptor[])
public final boolean fetchNext(DataValueDescriptor[] row)
throws StandardException
ScanController
fetchNext in interface ScanControllerrow - The destRow row into which the value
of the next position in the scan is to be stored.
StandardException - Standard exception policy.ScanController.fetch(org.apache.derby.iapi.types.DataValueDescriptor[]),
RowUtil
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||