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

public abstract Class GenericScanController

extends GenericController
implements ScanManager
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.access.conglomerate.ScanManager, org.apache.derby.iapi.store.access.GroupFetchScanController, org.apache.derby.iapi.store.access.GenericScanController, org.apache.derby.iapi.store.access.RowCountable, org.apache.derby.iapi.store.access.ScanController
Known Direct Subclasses
org.apache.derby.impl.store.access.heap.HeapScan
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.LogicalUndo, .ScanManager, org.apache.derby.iapi.store.access.Qualifier, .RowUtil, .ScanInfo, .BackingStoreHashtable, org.apache.derby.iapi.store.raw.ContainerHandle, .FetchDescriptor, .LockingPolicy, .Page, .RecordHandle, org.apache.derby.iapi.types.DataValueDescriptor, .RowLocation, org.apache.derby.iapi.services.io.FormatableBitSet

Generic class implementing shared ScanController methods. Logically a scancontroller is used to scan a set of rows that meet some specified qualification. Rows that meet the qualification may be operated upon by the scan to fetch, delete, or replace. The ScanController also supports the notion or "repositioning" the scan, which simply resets the beginning of the scan to a new place, and allows the user to continue from there. This class attempts to abstract out some of the parts of the scan such that maybe multiple access methods can share code, even if they perform parts of the scan wildly differently. Here is how the scan has been broken apart: scan_position - this variable holds the current scan position, it may be extended to provide more information if necessary. scan_state - a scan has 5 possible states: SCAN_INIT, SCAN_INPROGRESS, SCAN_DONE, SCAN_HOLD_INIT, and SCAN_HOLD_INPROGRESS positionAtInitScan() - This routine is called to move the scan to the SCAN_INIT state. It is used both for initialization of the ScanController and by reopenScan(). positionAtStartForForwardScan() - This routine is called to move the scan from SCAN_INIT to SCAN_INPROGRESS. Upon return from this routine it is expected that scan_position is set such that calling the generic scan loop will reach the first row of the scan. Note that this usually means setting the scan_postion to one before the 1st row to be returned. fetchRows() - This routine is the meat of the scan, it moves the scan to the next row, applies necessary qualifiers, and handles group or non-group operations. It moves through rows on a page in order and then moves to the "next" page. positionAtNextPage() - This routine handles moving the scan from the current scan_position to the next page. positionAtDoneScan() - Handle all cleanup associated with moving the scan state from SCAN_INPROGRESS to SCAN_DONE. This may include releasing locks, and setting the state of the scan. This does not close the scan, it allows for a reopenScan() to be called.

Field Summary

Modifier and TypeField and Description
private FetchDescriptor
private Qualifier[][]
private FormatableBitSet
init_scanColumnList

The following group of fields are all basic input parameters which are provided by the calling code when doing a scan.

private DataValueDescriptor[]
private int
private DataValueDescriptor[]
private int
private long
reusableRecordIdSequenceNumber

This is the sequence number for when a record id can be reused.

protected boolean
rowLocationsInvalidated

If this flag is set to true, a RowLocation returned from this controller may have been reused for another row.

public static final int
public static final int
public static final int
public static final int
SCAN_INIT

Constants of the class

public static final int
protected RowPosition
scan_position

The position for the current scan.

private int
scan_state

Delay positioning the table at the start position until the first next() call.

protected int
stat_numpages_visited

Performance counters ...

protected int
protected int
Inherited from org.apache.derby.impl.store.access.conglomerate.GenericController:
open_conglom

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected RowPosition
allocateScanPosition()

Create object which represents the scan position.

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 scan as part of terminating a transaction.

private void
closeScan()

Public Methods implementing ScanController:

public boolean
delete()

Implements org.apache.derby.iapi.store.access.ScanController.delete.

Delete the row at the current position of the scan.

public void
didNotQualify()

Implements org.apache.derby.iapi.store.access.ScanController.didNotQualify.

A call to allow client to indicate that current row does not qualify.

public boolean
doesCurrentPositionQualify()

Implements org.apache.derby.iapi.store.access.ScanController.doesCurrentPositionQualify.

Returns true if the current position of the scan still qualifies under the set of qualifiers passed to the openScan().

public void
fetch(DataValueDescriptor[]
The row into which the value of the current position in the scan is to be stored.
row
)

Implements org.apache.derby.iapi.store.access.ScanController.fetch.

Fetch the row at the current position of the Scan.

private void
fetch(DataValueDescriptor[]
The row into which the value of the current position in the scan is to be stored.
row
,
boolean
Indicates whether the qualifiers should be applied.
qualify
)

Fetch the row at the current position of the Scan.

public void
fetchLocation(RowLocation templateLocation)

Implements org.apache.derby.iapi.store.access.ScanController.fetchLocation.

Fetch the location of the current position in the scan.

protected int
fetchRows(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers)

Fetch the next N rows from the table.

public void
fetchSet(long
The maximum number of rows to insert into the Hash table. Pass in -1 if there is no maximum.
max_rowcnt
,
int[]
The column numbers of the columns in the scan result row to be the key to the Hashtable. "0" is the first column in the scan result row (which may be different than the first column in the row in the table of the scan).
key_column_numbers
,
BackingStoreHashtable
The java HashTable to load into.
hash_table
)

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

Insert all rows that qualify for the current scan into the input Hash table.

public void
fetchWithoutQualify(DataValueDescriptor[]
The row into which the value of the current position in the scan is to be stored.
row
)

Implements org.apache.derby.iapi.store.access.ScanController.fetchWithoutQualify.

Fetch the row at the current position of the Scan without applying the qualifiers.

public final int
public final int
public final int
public final Qualifier[][]
public final FormatableBitSet
public ScanInfo

Returns:

The ScanInfo object which contains info about current scan.
getScanInfo
()

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

Return ScanInfo object which describes performance of scan.

public final RowPosition
public final int
public final DataValueDescriptor[]
public final int
public final DataValueDescriptor[]
public final int
public void
init(OpenConglomerate open_conglom, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator)

Public Methods of This class:

public boolean
isCurrentPositionDeleted()

Implements org.apache.derby.iapi.store.access.ScanController.isCurrentPositionDeleted.

Returns true if the current position of the scan is at a deleted row.

public boolean
isHeldAfterCommit()

Implements org.apache.derby.iapi.store.access.ScanController.isHeldAfterCommit.

Return true is the scan has been closed after a commit, but was opened with holdability and can be reopened using positionAtRowLocation.

protected abstract RowLocation
makeRowLocation(RowPosition pos)

Make a RowLocation from a RowPosition

protected void
positionAtDoneScan(RowPosition pos)

Do any necessary work to complete the scan.

protected void
positionAtInitScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, RowPosition pos)

Move scan to the the SCAN_INIT state.

protected void
positionAtNextPage(RowPosition pos)

Position scan to slot before first slot on next page.

protected void
positionAtResumeScan(RowPosition pos)

Reposition the scan upon entering the fetchRows loop.

protected void
positionAtStartForForwardScan(RowPosition pos)

Move the scan from SCAN_INIT to SCAN_INPROGRESS.

protected final boolean

Returns:

true if the conglomerate has been reopened
reopenAfterEndTransaction
()

Reopens the scan after it has been closed as part of a commit.

public void
reopenScan(DataValueDescriptor[]
An indexable row which holds a (partial) key value which, in combination with the startSearchOperator, defines the starting position of the scan. If null, the starting position of the scan is the first row of the conglomerate.
startKeyValue
,
int
an operator which defines how the startKeyValue is to be searched for. If startSearchOperator is ScanController.GE, the scan starts on the first row which is greater than or equal to the startKeyValue. If startSearchOperation is ScanController.GT, the scan starts on the first row whose key is greater than startKeyValue. The startSearchOperation parameter is ignored if the startKeyValue parameter is null.
startSearchOperator
,
Qualifier[][]
An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.
qualifier
,
DataValueDescriptor[]
An indexable row which holds a (partial) key value which, in combination with the stopSearchOperator, defines the ending position of the scan. If null, the ending position of the scan is the last row of the conglomerate.
stopKeyValue
,
int
an operator which defines how the stopKeyValue is used to determine the scan stopping position. If stopSearchOperation is ScanController.GE, the scan stops just before the first row which is greater than or equal to the stopKeyValue. If stopSearchOperation is ScanController.GT, the scan stops just before the first row whose key is greater than startKeyValue. The stopSearchOperation parameter is ignored if the stopKeyValue parameter is null.
stopSearchOperator
)

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

Reposition the current scan.

protected void
reopenScanByRecordHandle(RecordHandle
An existing RecordHandle within the conglomerate, at which to position the start of the scan. The scan will begin at this location and continue forward until the end of the conglomerate. Positioning at a non-existent RowLocation (ie. an invalid one or one that had been deleted), will result in an exception being thrown when the first next operation is attempted.
startRecordHandle
,
Qualifier[][]
An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.
qualifier
)

Reposition the current scan.

public void
reopenScanByRowLocation(RowLocation
An existing RowLocation within the conglomerate, at which to position the start of the scan. The scan will begin at this location and continue forward until the end of the conglomerate. Positioning at a non-existent RowLocation (ie. an invalid one or one that had been deleted), will result in an exception being thrown when the first next operation is attempted.
startRowLocation
,
Qualifier[][]
An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.
qualifier
)

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

Reposition the current scan.

public boolean
replace(DataValueDescriptor[] row, FormatableBitSet validColumns)

Implements org.apache.derby.iapi.store.access.ScanController.replace.

Replace the (partial) row at the current position of the scan.

private final void
repositionScanForUpateOper()

Private methods of This class:

protected abstract void
setRowLocationArray(RowLocation[] rowloc_array, int index, RowPosition pos)

public final void
public final void
setScanState(int state)

Inherited from org.apache.derby.impl.store.access.conglomerate.GenericController:
checkConsistencydebugConglomerategetEstimatedRowCountgetInternalTablePropertySetgetOpenConglomgetRowPositionFromRowLocationgetSpaceInfogetTablePropertiesinitisKeyedisTableLockednewRowLocationTemplatequeueDeletePostCommitWorksetEstimatedRowCount

Field Detail

init_fetchDescback to summary
private FetchDescriptor init_fetchDesc
init_qualifierback to summary
private Qualifier[][] init_qualifier
init_scanColumnListback to summary
private FormatableBitSet init_scanColumnList

The following group of fields are all basic input parameters which are provided by the calling code when doing a scan. These are just saved values from what was initially input.

init_startKeyValueback to summary
private DataValueDescriptor[] init_startKeyValue
init_startSearchOperatorback to summary
private int init_startSearchOperator
init_stopKeyValueback to summary
private DataValueDescriptor[] init_stopKeyValue
init_stopSearchOperatorback to summary
private int init_stopSearchOperator
reusableRecordIdSequenceNumberback to summary
private long reusableRecordIdSequenceNumber

This is the sequence number for when a record id can be reused. If it has been changed in the container, a RowLocation may be reused for another row.

rowLocationsInvalidatedback to summary
protected boolean rowLocationsInvalidated

If this flag is set to true, a RowLocation returned from this controller may have been reused for another row.

SCAN_DONEback to summary
public static final int SCAN_DONE
SCAN_HOLD_INITback to summary
public static final int SCAN_HOLD_INIT
SCAN_HOLD_INPROGRESSback to summary
public static final int SCAN_HOLD_INPROGRESS
SCAN_INITback to summary
public static final int SCAN_INIT

Constants of the class

SCAN_INPROGRESSback to summary
public static final int SCAN_INPROGRESS
scan_positionback to summary
protected RowPosition scan_position

The position for the current scan. The can be maintained in any of the following ways: record handle - scan_position.current_rh: The scan maintains it's position using the record handle while it does not have a latch on the page, which is the case anytime control leaves access. The access method must take appropriate steps to make sure the record handle will still be valid when the scan needs to reposition using the record handle. slot number - scan_position.current_slot: While the scan has a latch on the page the scan is positioned using the slot number as the order of the rows cannot change while the latch is held (unless the holder of the latch causes them to move). page number - (RESOLVE - TODO) Sometimes it would be interesting to position a scan "between" pages, such that the next time the scan starts is starts at the next page. This would allow us to efficiently do group scans returning page at atime results. NOT IMPLEMENTED CURRENTLY.

scan_stateback to summary
private int scan_state

Delay positioning the table at the start position until the first next() call.

stat_numpages_visitedback to summary
protected int stat_numpages_visited

Performance counters ...

stat_numrows_qualifiedback to summary
protected int stat_numrows_qualified
stat_numrows_visitedback to summary
protected int stat_numrows_visited

Constructor Detail

GenericScanControllerback to summary
public GenericScanController()

Method Detail

allocateScanPositionback to summary
protected RowPosition allocateScanPosition() throws StandardException

Create object which represents the scan position.

Designed so that extending classes can override and allocate implementation specific row position's.

Exceptions
StandardException:
Standard exception policy.
closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.store.access.conglomerate.GenericController.close.

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

Doc from org.apache.derby.iapi.store.access.GenericScanController.close.

Close the scan. This method always succeeds, and never throws any exceptions. Callers must not use the scan controller after closing it; they are strongly advised to clear out the scan controller reference after closing.

Exceptions
StandardException:
Standard exception policy.
closeForEndTransactionback to summary
public boolean closeForEndTransaction(boolean closeHeldScan) throws StandardException

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

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

Close scan as part of terminating a transaction.

Use this call to close the scan resources as part of committing or aborting a transaction. The normal close() routine may do some cleanup that is either unnecessary, or not correct due to the unknown condition of the scan following a transaction ending error. Use this call when closing all scans as part of an abort of a transaction.

Parameters
closeHeldScan: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.

Returns:boolean

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.

Exceptions
StandardException:
Standard exception policy.
closeScanback to summary
private void closeScan() throws StandardException

Public Methods implementing ScanController:

deleteback to summary
public boolean delete() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.delete.

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

Delete the row at the current position of the scan.

Returns:boolean

true if the delete was successful, false if the current position is no longer valid (ie. if it was already deleted).

Exceptions
StandardException:
Standard exception policy.
See Also
org.apache.derby.iapi.store.access.ScanController#delete
didNotQualifyback to summary
public void didNotQualify() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.didNotQualify.

A call to allow client to indicate that current row does not qualify.

Indicates to the ScanController that the current row does not qualify for the scan. If the isolation level of the scan allows, this may result in the scan releasing the lock on this row.

Note that some scan implimentations may not support releasing locks on non-qualifying rows, or may delay releasing the lock until sometime later in the scan (ie. it may be necessary to keep the lock until either the scan is repositioned on the next row or page).

This call should only be made while the scan is positioned on a current valid row. RESOLVE (mikem-05/29/98) - Implement this when we support levels of concurrency less than serializable.

Exceptions
StandardException:
Standard exception policy.
doesCurrentPositionQualifyback to summary
public boolean doesCurrentPositionQualify() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.doesCurrentPositionQualify.

Returns true if the current position of the scan still qualifies under the set of qualifiers passed to the openScan(). When called this routine will reapply all qualifiers against the row currently positioned and return true if the row still qualifies. If the row has been deleted or no longer passes the qualifiers then this routine will return false. This case can come about if the current scan or another scan on the same table in the same transaction deleted the row or changed columns referenced by the qualifier after the next() call which positioned the scan at this row. Note that for comglomerates which don't support update, like btree's, there is no need to recheck the qualifiers. The results of a fetch() performed on a scan positioned on a deleted row are undefined.

Exceptions
StandardException:
Standard exception policy.
fetchback to summary
public void fetch(DataValueDescriptor[] row) throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.fetch.

Fetch the row at the current position of the Scan.

Parameters
row:DataValueDescriptor[]

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

The row into which the value of the current position in the scan is to be stored.

Exceptions
StandardException:

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

Standard exception policy.

See Also
org.apache.derby.iapi.store.access.ScanController#fetch
fetchback to summary
private void fetch(DataValueDescriptor[] row, boolean qualify) throws StandardException

Fetch the row at the current position of the Scan.

Parameters
row:DataValueDescriptor[]

The row into which the value of the current position in the scan is to be stored.

qualify:boolean

Indicates whether the qualifiers should be applied.

Exceptions
StandardException:
Standard exception policy.
fetchLocationback to summary
public void fetchLocation(RowLocation templateLocation) throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.fetchLocation.

Fetch the location of the current position in the scan.

Exceptions
StandardException:
Standard exception policy.
See Also
org.apache.derby.iapi.store.access.ScanController#fetchLocation
fetchRowsback to summary
protected int fetchRows(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers) throws StandardException

Fetch the next N rows from the table.

Utility routine used by both fetchSet() and fetchNextGroup().

Exceptions
StandardException:
Standard exception policy.
fetchSetback to summary
public void fetchSet(long max_rowcnt, int[] key_column_numbers, BackingStoreHashtable hash_table) throws StandardException

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

Insert all rows that qualify for the current scan into the input Hash table.

This routine scans executes the entire scan as described in the openScan call. For every qualifying unique row value an entry is placed into the HashTable. For unique row values the entry in the Hashtable has a key value of the object stored in row[key_column_number], and the value of the data is row. For row values with duplicates, the key value is also row[key_column_number], but the value of the data is a List of rows. The caller will have to call "instanceof" on the data value object if duplicates are expected, to determine if the data value of the Hashtable entry is a row or is a List of rows.

Note, that for this routine to work efficiently the caller must ensure that the object in row[key_column_number] implements the hashCode and equals method as appropriate for it's datatype.

It is expected that this call will be the first and only call made in an openscan. Qualifiers and stop position of the openscan are applied just as in a normal scan. This call is logically equivalent to the caller performing the following:

import java.util.Hashtable;

hash_table = new Hashtable();

while (next())
{
    row = create_new_row();
    fetch(row);
    if ((duplicate_value = 
        hash_table.put(row[key_column_number], row)) != null)
    {
        Vector row_vec;

        // inserted a duplicate
        if ((duplicate_value instanceof vector))
        {
            row_vec = (Vector) duplicate_value;
        }
        else
        {
            // allocate vector to hold duplicates
            row_vec = new Vector(2);

            // insert original row into vector
            row_vec.addElement(duplicate_value);

            // put the vector as the data rather than the row
            hash_table.put(row[key_column_number], row_vec);
        }

        // insert new row into vector
        row_vec.addElement(row);
    }
}

The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description. RESOLVE - is this ok? or should I hard code somehow the row to be the first column and the row location?

Currently it is only possible to hash on the first column in the conglomerate, in the future we may change the interface to allow hashing either on a different column or maybe on a combination of columns.

No overflow to external storage is provided, so calling this routine on a 1 gigabyte conglomerate will incur at least 1 gigabyte of memory (probably failing with a java out of memory condition). If this routine gets an out of memory condition, or if "max_rowcnt" is exceeded then then the routine will give up, empty the Hashtable, and return "false."

On exit from this routine, whether the fetchSet() succeeded or not the scan is complete, it is positioned just the same as if the scan had been drained by calling "next()" until it returns false (ie. fetchNext() and next() calls will return false). reopenScan() can be called to restart the scan.

RESOLVE - until we get row counts what should we do for sizing the the size, capasity, and load factor of the hash table. For now it is up to the caller to create the Hashtable, Access does not reset any parameters.

RESOLVE - I am not sure if access should be in charge of allocating the new row objects. I know that I can do this in the case of btree's, but I don't think I can do this in heaps. Maybe this is solved by work to be done on the sort interface.

Parameters
max_rowcnt:long

The maximum number of rows to insert into the Hash table. Pass in -1 if there is no maximum.

key_column_numbers:int[]

The column numbers of the columns in the scan result row to be the key to the Hashtable. "0" is the first column in the scan result row (which may be different than the first column in the row in the table of the scan).

hash_table:BackingStoreHashtable

The java HashTable to load into.

Exceptions
StandardException:
Standard exception policy.
fetchWithoutQualifyback to summary
public void fetchWithoutQualify(DataValueDescriptor[] row) throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.fetchWithoutQualify.

Fetch the row at the current position of the Scan without applying the qualifiers.

Parameters
row:DataValueDescriptor[]

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

The row into which the value of the current position in the scan is to be stored.

Exceptions
StandardException:

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

Standard exception policy.

See Also
org.apache.derby.iapi.store.access.ScanController#fetchWithoutQualify
getNumPagesVisitedback to summary
public final int getNumPagesVisited()
getNumRowsQualifiedback to summary
public final int getNumRowsQualified()
getNumRowsVisitedback to summary
public final int getNumRowsVisited()
getQualifierback to summary
public final Qualifier[][] getQualifier()
getScanColumnListback to summary
public final FormatableBitSet getScanColumnList()
getScanInfoback to summary
public ScanInfo getScanInfo() throws StandardException

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

Return ScanInfo object which describes performance of scan.

Return ScanInfo object which contains information about the current scan.

Returns:ScanInfo

The ScanInfo object which contains info about current scan.

Exceptions
StandardException:
Standard exception policy.
See Also
ScanInfo
getScanPositionback to summary
public final RowPosition getScanPosition()
getScanStateback to summary
public final int getScanState()
getStartKeyValueback to summary
public final DataValueDescriptor[] getStartKeyValue()
getStartSearchOperatorback to summary
public final int getStartSearchOperator()
getStopKeyValueback to summary
public final DataValueDescriptor[] getStopKeyValue()
getStopSearchOperatorback to summary
public final int getStopSearchOperator()
initback to summary
public void init(OpenConglomerate open_conglom, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException

Public Methods of This class:

isCurrentPositionDeletedback to summary
public boolean isCurrentPositionDeleted() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.isCurrentPositionDeleted.

Returns true if the current position of the scan is at a deleted row. This case can come about if the current scan or another scan on the same table in the same transaction deleted the row after the next() call which positioned the scan at this row. The results of a fetch() performed on a scan positioned on a deleted row are undefined.

Exceptions
StandardException:
Standard exception policy.
isHeldAfterCommitback to summary
public boolean isHeldAfterCommit() throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.isHeldAfterCommit.

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

Return true is the scan has been closed after a commit, but was opened with holdability and can be reopened using positionAtRowLocation.

Exceptions
StandardException:
Standard exception policy.
See Also
org.apache.derby.iapi.store.access.ScanController#isHeldAfterCommit
makeRowLocationback to summary
protected abstract RowLocation makeRowLocation(RowPosition pos) throws StandardException

Make a RowLocation from a RowPosition

positionAtDoneScanback to summary
protected void positionAtDoneScan(RowPosition pos) throws StandardException

Do any necessary work to complete the scan.

Exceptions
StandardException:
Standard exception policy.
positionAtInitScanback to summary
protected void positionAtInitScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, RowPosition pos) throws StandardException

Move scan to the the SCAN_INIT state.

This routine is called to move the scan to the SCAN_INIT state. It is used both for initialization of the ScanController and by reopenScan().

positionAtNextPageback to summary
protected void positionAtNextPage(RowPosition pos) throws StandardException

Position scan to slot before first slot on next page.

Exceptions
StandardException:
Standard exception policy.
positionAtResumeScanback to summary
protected void positionAtResumeScan(RowPosition pos) throws StandardException

Reposition the scan upon entering the fetchRows loop.

Called upon entering fetchRows() while in the SCAN_INPROGRESS state. Do work necessary to look at rows in the current page of the scan.

The default implementation uses a record handle to maintain a scan position. It will get the latch again on the current scan position and set the slot to the current record handle.

Exceptions
StandardException:
Standard exception policy.
positionAtStartForForwardScanback to summary
protected void positionAtStartForForwardScan(RowPosition pos) throws StandardException

Move the scan from SCAN_INIT to SCAN_INPROGRESS.

This routine is called to move the scan from SCAN_INIT to SCAN_INPROGRESS. Upon return from this routine it is expected that scan_position is set such that calling the generic scan loop will reach the first row of the scan. Note that this usually means setting the scan_postion to one before the 1st row to be returned.

Exceptions
StandardException:
Standard exception policy.
reopenAfterEndTransactionback to summary
protected final boolean reopenAfterEndTransaction() throws StandardException

Reopens the scan after it has been closed as part of a commit. This method will check the reusableRecordIdSequenceNumber of the container, and will set the rowLocationsInvalidated flag if it has changed.

Returns:boolean

true if the conglomerate has been reopened

Exceptions
StandardException:
Derby standard exception
reopenScanback to summary
public void reopenScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException

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

Reposition the current scan. This call is semantically the same as if the current scan had been closed and a openScan() had been called instead. The scan is reopened with against the same conglomerate, and the scan is reopened with the same "hold" and "forUpdate" parameters passed in the original openScan. The previous template row continues to be used.

Parameters
startKeyValue:DataValueDescriptor[]

An indexable row which holds a (partial) key value which, in combination with the startSearchOperator, defines the starting position of the scan. If null, the starting position of the scan is the first row of the conglomerate.

startSearchOperator:int

an operator which defines how the startKeyValue is to be searched for. If startSearchOperator is ScanController.GE, the scan starts on the first row which is greater than or equal to the startKeyValue. If startSearchOperation is ScanController.GT, the scan starts on the first row whose key is greater than startKeyValue. The startSearchOperation parameter is ignored if the startKeyValue parameter is null.

qualifier:Qualifier[][]

An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.

stopKeyValue:DataValueDescriptor[]

An indexable row which holds a (partial) key value which, in combination with the stopSearchOperator, defines the ending position of the scan. If null, the ending position of the scan is the last row of the conglomerate.

stopSearchOperator:int

an operator which defines how the stopKeyValue is used to determine the scan stopping position. If stopSearchOperation is ScanController.GE, the scan stops just before the first row which is greater than or equal to the stopKeyValue. If stopSearchOperation is ScanController.GT, the scan stops just before the first row whose key is greater than startKeyValue. The stopSearchOperation parameter is ignored if the stopKeyValue parameter is null.

Exceptions
StandardException:
Standard exception policy.
reopenScanByRecordHandleback to summary
protected void reopenScanByRecordHandle(RecordHandle startRecordHandle, Qualifier[][] qualifier) throws StandardException

Reposition the current scan. This call is semantically the same as if the current scan had been closed and a openScan() had been called instead. The scan is reopened against the same conglomerate, and the scan is reopened with the same "scan column list", "hold" and "forUpdate" parameters passed in the original openScan.

The statistics gathered by the scan are not reset to 0 by a reopenScan(), rather they continue to accumulate.

Note that this operation is currently only supported on Heap conglomerates. Also note that order of rows within are heap are not guaranteed, so for instance positioning at a RowLocation in the "middle" of a heap, then inserting more data, then continuing the scan is not guaranteed to see the new rows - they may be put in the "beginning" of the heap.

Parameters
startRecordHandle:RecordHandle

An existing RecordHandle within the conglomerate, at which to position the start of the scan. The scan will begin at this location and continue forward until the end of the conglomerate. Positioning at a non-existent RowLocation (ie. an invalid one or one that had been deleted), will result in an exception being thrown when the first next operation is attempted.

qualifier:Qualifier[][]

An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.

Exceptions
StandardException:
Standard exception policy.
reopenScanByRowLocationback to summary
public void reopenScanByRowLocation(RowLocation startRowLocation, Qualifier[][] qualifier) throws StandardException

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

Doc from org.apache.derby.iapi.store.access.GenericScanController.reopenScanByRowLocation.

Reposition the current scan. This call is semantically the same as if the current scan had been closed and a openScan() had been called instead. The scan is reopened against the same conglomerate, and the scan is reopened with the same "scan column list", "hold" and "forUpdate" parameters passed in the original openScan.

The statistics gathered by the scan are not reset to 0 by a reopenScan(), rather they continue to accumulate.

Note that this operation is currently only supported on Heap conglomerates. Also note that order of rows within are heap are not guaranteed, so for instance positioning at a RowLocation in the "middle" of a heap, then inserting more data, then continuing the scan is not guaranteed to see the new rows - they may be put in the "beginning" of the heap.

Parameters
startRowLocation:RowLocation

An existing RowLocation within the conglomerate, at which to position the start of the scan. The scan will begin at this location and continue forward until the end of the conglomerate. Positioning at a non-existent RowLocation (ie. an invalid one or one that had been deleted), will result in an exception being thrown when the first next operation is attempted.

qualifier:Qualifier[][]

An array of qualifiers which, applied to each key, restrict the rows returned by the scan. Rows for which any one of the qualifiers returns false are not returned by the scan. If null, all rows are returned.

Exceptions
StandardException:
Standard exception policy.
replaceback to summary
public boolean replace(DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException

Implements org.apache.derby.iapi.store.access.ScanController.replace.

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

Replace the (partial) row at the current position of the scan.

Returns:boolean

true if the replace was successful, false if the current position is no longer valid (ie. if it was deleted).

Exceptions
StandardException:
Standard exception policy.
See Also
org.apache.derby.iapi.store.access.ScanController#replace
repositionScanForUpateOperback to summary
private final void repositionScanForUpateOper() throws StandardException

Private methods of This class:

setRowLocationArrayback to summary
protected abstract void setRowLocationArray(RowLocation[] rowloc_array, int index, RowPosition pos) throws StandardException
setScanPositionback to summary
public final void setScanPosition(RowPosition pos)
setScanStateback to summary
public final void setScanState(int state)