Top Description Fields Constructors Methods
org.apache.derby.impl.store.access.sort

public Class MergeScan

extends SortScan
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.store.access.sort.MergeScanRowSource
Imports
java.util.Enumeration, .Vector, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.TransactionManager, .ScanManager, org.apache.derby.iapi.store.access.SortObserver, org.apache.derby.iapi.store.raw.StreamContainerHandle, .Transaction, org.apache.derby.iapi.types.DataValueDescriptor

A sort scan that is capable of merging as many merge runs as will fit in the passed-in sort buffer.

Field Summary

Modifier and TypeField and Description
protected Vector<Long>
mergeRuns

The merge runs.

protected StreamContainerHandle[]
openScans

Array of scan controllers for the merge runs.

protected SortBuffer
sortBuffer

The sort buffer we will use.

private SortObserver
Inherited from org.apache.derby.impl.store.access.sort.SortScan:
currentholdsorttran

Constructor Summary

AccessConstructor and Description
pack-priv
MergeScan(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold)

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
closeForEndTransaction(boolean
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.
closeHeldScan
)

Implements org.apache.derby.iapi.store.access.conglomerate.ScanManager.closeForEndTransaction.

Close the scan.

public boolean
init(TransactionManager tran)

Initialize the scan, returning false if there was some error.

pack-priv void
mergeARow(int scanindex)

Insert rows while we keep getting duplicates from the merge run whose scan is in the open scan array entry indexed by scanindex.

public boolean
Inherited from org.apache.derby.impl.store.access.sort.SortScan:
fetchfetchNextfetchWithoutQualify

Field Detail

mergeRunsback to summary
protected Vector<Long> mergeRuns

The merge runs.

openScansback to summary
protected StreamContainerHandle[] openScans

Array of scan controllers for the merge runs. Entries in the array become null as the last row is pulled out and the scan is closed.

sortBufferback to summary
protected SortBuffer sortBuffer

The sort buffer we will use.

sortObserverback to summary
private SortObserver sortObserver

Constructor Detail

MergeScanback to summary
pack-priv MergeScan(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold)

Method Detail

closeback to summary
public void close()

Overrides org.apache.derby.impl.store.access.sort.SortScan.close.

Implements org.apache.derby.iapi.store.access.GenericScanController.close.

Close the scan.

See Also
org.apache.derby.iapi.store.access.ScanController#close
closeForEndTransactionback to summary
public boolean closeForEndTransaction(boolean closeHeldScan)

Implements org.apache.derby.iapi.store.access.conglomerate.ScanManager.closeForEndTransaction.

Close the scan.

Parameters
closeHeldScan:boolean

Doc from org.apache.derby.iapi.store.access.conglomerate.ScanManager.closeForEndTransaction.

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.

Returns:boolean

Doc from org.apache.derby.iapi.store.access.conglomerate.ScanManager.closeForEndTransaction.

boolean indicating that the close has resulted in a real close of the scan. A held scan will return false if called by closeForEndTransaction(false), otherwise it will return true. A non-held scan will always return true.

See Also
ScanManager#closeForEndTransaction
initback to summary
public boolean init(TransactionManager tran) throws StandardException

Initialize the scan, returning false if there was some error.

mergeARowback to summary
pack-priv void mergeARow(int scanindex) throws StandardException

Insert rows while we keep getting duplicates from the merge run whose scan is in the open scan array entry indexed by scanindex.

nextback to summary
public boolean next() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.next, org.apache.derby.iapi.store.access.GroupFetchScanController.next.

Move to the next position in the scan.

Returns:boolean

Doc from org.apache.derby.iapi.store.access.ScanController.next.

True if there is a next position in the scan, false if there isn't.

Exceptions
StandardException:

Doc from org.apache.derby.iapi.store.access.ScanController.next.

Standard exception policy.

See Also
org.apache.derby.iapi.store.access.ScanController#next