Scans are opened from a TransactionController.
A ScanController can handle partial rows. Partial rows
are described in RowUtil.
A scan controller is opened with a FormatableBitSet that describes the
columns that need to be returned on a fetch call. This FormatableBitSet
need not include any columns referenced in the qualifers, start
and/or stop keys.
TransactionController#openScan, GenericScanController, RowCountable, RowUtil
| Modifier and Type | Field and Description |
|---|---|
| public static final int | GE
GE is used to position a scan at values greater than or or equal to the given key in the scan. |
| public static final int | GT
GT is used to position a scan at values greater than the given key. |
| public static final int | NA
NA - argument is unused in call. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the delete was successful, false if the current position is no longer valid (ie. if it was already deleted).Delete the row at the current position of the scan. |
| public void | |
| public boolean | 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. destRow)Fetch the (partial) row at the current position of the Scan. |
| public void | |
| public boolean | Returns: True if there is a next position in the scan, false if there isn't.The destRow row into which the value
of the next position in the scan is to be stored. destRow)Fetch the (partial) row at the next position of the Scan. |
| public void | fetchWithoutQualify(DataValueDescriptor[]
The row into which the value of the current
position in the scan is to be stored. destRow)The same as fetch, except that the qualifiers passed to the openScan() will not be applied. |
| public boolean | |
| public boolean | isHeldAfterCommit()
Return true is the scan has been closed after a commit, but was opened with holdability and can be reopened using positionAtRowLocation. |
| public boolean | Returns: True if there is a next position in the scan, false if there isn't.Move to the next position in the scan. |
| public boolean | Returns: true if the scan has been positioned at the RowLocation. false if the scan could not be positioned.RowLocation for the new position for the scan. The
RowLocation submitted should be a RowLocation which has
previously been returned by this ScanController. rl)Positions the scan at row location and locks the row. |
| public boolean | Returns: true if the replace was successful, false if the current position is no longer valid (ie. if it was deleted).Replace the (partial) row at the current position of the scan. |
| GE | back to summary |
|---|---|
| public static final int GE GE is used to position a scan at values greater than or or equal to the given key in the scan. This positioning argument refers to the order within the scan (not necessarily actual compare calls on the datatypes). "greater" than is interpreted in terms of the current conglomerate and scan. For instance, a btree may be ordered ascending on an int, in that case a 2 is "greater" than 1 in a forward scan on that index, and 1 is "greater" than 2 in a backward scan. If the btree was ordered descending on an int then 1 is "greater" than 2 in a forward scan on that index, and 2 is "greater" than 1 in a backward scan.
| |
| GT | back to summary |
|---|---|
| public static final int GT GT is used to position a scan at values greater than the given key. This positioning argument refers to the order within the scan (not necessarily actual compare calls on the datatypes). "greater" than is interpreted in terms of the current conglomerate and scan. For instance, a btree may be ordered ascending on an int, in that case a 2 is "greater" than 1 in a forward scan on that index, and 1 is "greater" than 2 in a backward scan. If the btree was ordered descending on an int then 1 is "greater" than 2 in a forward scan on that index, and 2 is "greater" than 1 in a backward scan.
| |
| NA | back to summary |
|---|---|
| public static final int NA NA - argument is unused in call. For some scans the key is set to null to indicate no start or stop position, in those cases the position operator is ignored.
| |
| delete | back to summary |
|---|---|
| public boolean delete() throws StandardException Delete the row at the current position of the scan.
| |
| didNotQualify | back to summary |
|---|---|
| public void didNotQualify() throws StandardException 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.
| |
| doesCurrentPositionQualify | back to summary |
|---|---|
| public boolean doesCurrentPositionQualify() throws StandardException 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, note that this can happen even if next() has returned true (for instance the client can delete the row, or if using read uncommitted another thread can delete the row after the next() call but before the fetch).
| |
| fetch | back to summary |
|---|---|
| public void fetch(DataValueDescriptor[] destRow) throws StandardException Fetch the (partial) row at the current position of the Scan.
The value in the destRow storable row is replaced
with the value of the row at the current scan
position. The columns of the destRow row must
be of the same type as the actual columns in the
underlying conglomerate. The number of elements in
fetch must be compatible with the number of scan columns
requested at the openScan call time.
| |
| fetchLocation | back to summary |
|---|---|
| public void fetchLocation(RowLocation destRowLocation) throws StandardException Fetch the location of the current position in the scan. The destination location is replaced with the location corresponding to the current position in the scan. The destination location must be of the correct actual type to accept a location from the underlying conglomerate location. The results of a fetchLocation() performed on a scan after next() has returned false are undefined. The results of a fetchLocation() performed on a scan positioned on a deleted row are undefined, note that this can happen even if next() has returned true (for instance the client can delete the row, or if using read uncommitted another thread can delete the row after the next() call but before the fetchLocation).
| |
| fetchNext | back to summary |
|---|---|
| public boolean fetchNext(DataValueDescriptor[] destRow) throws StandardException Fetch the (partial) row at the next position of the Scan. If there is a valid next position in the scan then the value in the destRow storable row is replaced with the value of the row at the current scan position. The columns of the destRow row must be of the same type as the actual columns in the underlying conglomerate. The resulting contents of destRow after a fetchNext() which returns false is undefined. The result of calling fetchNext(row) is exactly logically equivalent to making a next() call followed by a fetch(row) call. This interface allows implementations to optimize the 2 calls if possible.
| |
| fetchWithoutQualify | back to summary |
|---|---|
| public void fetchWithoutQualify(DataValueDescriptor[] destRow) throws StandardException The same as fetch, except that the qualifiers passed to the openScan() will not be applied. destRow will contain the current row even if it has been changed and no longer qualifies.
| |
| isCurrentPositionDeleted | back to summary |
|---|---|
| public boolean isCurrentPositionDeleted() throws StandardException 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.
| |
| isHeldAfterCommit | back to summary |
|---|---|
| public boolean isHeldAfterCommit() throws StandardException Return true is the scan has been closed after a commit, but was opened with holdability and can be reopened using positionAtRowLocation.
| |
| next | back to summary |
|---|---|
| public boolean next() throws StandardException Move to the next position in the scan. If this is the first call to next(), the position is set to the first row. Returns false if there is not a next row to move to. It is possible, but not guaranteed, that this method could return true again, after returning false, if some other operation in the same transaction appended a row to the underlying conglomerate.
| |
| positionAtRowLocation | back to summary |
|---|---|
| public boolean positionAtRowLocation(RowLocation rl) throws StandardException Positions the scan at row location and locks the row. If the scan is not opened, it will be reopened if this is a holdable scan and there has not been any operations which causes RowLocations to be invalidated.
| |
| replace | back to summary |
|---|---|
| public boolean replace(DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException Replace the (partial) row at the current position of the scan.
| |