ScanManager
, GenericScanController
, GroupFetchScanController
, RowCountable
, ScanController
, ScanInfo
SortBufferRowSource
, SortScan
public abstract class Scan extends java.lang.Object implements ScanManager, ScanInfo
GE, GT, NA
Constructor | Description |
---|---|
Scan() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
delete() |
Delete the row at the current position of the scan.
|
void |
didNotQualify() |
A call to allow client to indicate that current row does not qualify.
|
boolean |
doesCurrentPositionQualify() |
Returns true if the current position of the scan still qualifies
under the set of qualifiers passed to the openScan().
|
void |
fetchLocation(RowLocation templateLocation) |
Fetch the location of the current position in the scan.
|
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] rowloc_array) |
Fetch the next N rows from the table.
|
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] old_rowloc_array,
RowLocation[] new_rowloc_array) |
|
void |
fetchSet(long max_rowcnt,
int[] key_column_numbers,
BackingStoreHashtable hash_table) |
Insert all rows that qualify for the current scan into the input
Hash table.
|
java.util.Properties |
getAllScanInfo(java.util.Properties prop) |
Return all information gathered about the scan.
|
long |
getEstimatedRowCount() |
Get the total estimated number of rows in the container.
|
ScanInfo |
getScanInfo() |
Return ScanInfo object which describes performance of scan.
|
boolean |
isCurrentPositionDeleted() |
Returns true if the current position of the scan is at a
deleted row.
|
boolean |
isHeldAfterCommit() |
Return true is the scan has been closed after a commit, but was
opened with holdability and can be reopened using
positionAtRowLocation.
|
boolean |
isKeyed() |
Return whether this is a keyed conglomerate.
|
boolean |
isTableLocked() |
Return whether this scan is table locked.
|
RowLocation |
newRowLocationTemplate() |
Return a row location object of the correct type to be
used in calls to fetchLocation.
|
boolean |
positionAtRowLocation(RowLocation rl) |
Positions the scan at row location and locks the row.
|
void |
reopenScan(DataValueDescriptor[] startKeyValue,
int startSearchOperator,
Qualifier[][] qualifier,
DataValueDescriptor[] stopKeyValue,
int stopSearchOperator) |
Reposition the current scan.
|
void |
reopenScanByRowLocation(RowLocation startRowLocation,
Qualifier[][] qualifier) |
Reposition the current scan.
|
boolean |
replace(DataValueDescriptor[] val,
FormatableBitSet validColumns) |
Replace the entire row at the current position of the scan.
|
void |
setEstimatedRowCount(long count) |
Set the total estimated number of rows in the container.
|
close
next
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fetch, fetchNext, fetchWithoutQualify, next
closeForEndTransaction
public void didNotQualify() throws StandardException
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.
This call does not make sense for sort scans.
didNotQualify
in interface ScanController
StandardException
- Standard exception policy.public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array) throws StandardException
Currently unimplemented for sorts.
fetchNextGroup
in interface GroupFetchScanController
row_array
- The array of rows to copy rows into.
row_array[].length must >= 1. The first entry
must be non-null destination rows, other entries
may be null and will be allocated by access
if needed.rowloc_array
- If non-null, the array of row locations to
copy into. If null, no row locations are
retrieved.StandardException
- Standard exception policy.public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] old_rowloc_array, RowLocation[] new_rowloc_array) throws StandardException
fetchNextGroup
in interface GroupFetchScanController
StandardException
public void fetchSet(long max_rowcnt, int[] key_column_numbers, BackingStoreHashtable hash_table) throws StandardException
Currently unimplemented for sorts.
fetchSet
in interface ScanManager
max_rowcnt
- The maximum number of rows to insert into the
Hash table. Pass in -1 if there is no maximum.key_column_numbers
- 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
row in the table of the scan).StandardException
- Standard exception policy.public boolean doesCurrentPositionQualify() throws StandardException
doesCurrentPositionQualify
in interface ScanController
StandardException
- Standard exception policy.ScanController.doesCurrentPositionQualify()
public void fetchLocation(RowLocation templateLocation) throws StandardException
fetchLocation
in interface ScanController
StandardException
- Standard exception policy.ScanController.fetchLocation(org.apache.derby.iapi.types.RowLocation)
public ScanInfo getScanInfo() throws StandardException
Return ScanInfo object which contains information about the current scan.
Currently the ScanInfo does not have any performance data.
getScanInfo
in interface GenericScanController
StandardException
- Standard exception policy.ScanInfo
public long getEstimatedRowCount() throws StandardException
The number is a rough estimate and may be grossly off. In general the server will cache the row count and then occasionally write the count unlogged to a backing store. If the system happens to shutdown before the store gets a chance to update the row count it may wander from reality.
This call is currently only supported on Heap conglomerates, it will throw an exception if called on btree conglomerates.
getEstimatedRowCount
in interface RowCountable
StandardException
- Standard exception policy.public void setEstimatedRowCount(long count) throws StandardException
Often, after a scan, the client of RawStore has a much better estimate of the number of rows in the container than what store has. For instance if we implement some sort of update statistics command, or just after a create index a complete scan will have been done of the table. In this case this interface allows the client to set the estimated row count for the container, and store will use that number for all future references.
This call is currently only supported on Heap conglomerates, it will throw an exception if called on btree conglomerates.
setEstimatedRowCount
in interface RowCountable
count
- the estimated number of rows in the container.StandardException
- Standard exception policy.public boolean isCurrentPositionDeleted() throws StandardException
isCurrentPositionDeleted
in interface ScanController
StandardException
- Standard exception policy.ScanController.isCurrentPositionDeleted()
public boolean isKeyed()
isKeyed
in interface GenericScanController
public boolean isTableLocked()
isTableLocked
in interface GenericScanController
public boolean delete() throws StandardException
delete
in interface ScanController
StandardException
- Standard exception policy.ScanController.delete()
public void reopenScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException
reopenScan
in interface GenericScanController
startKeyValue
- 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
- 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
- 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
- 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
- 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.StandardException
- Standard exception policy.GenericScanController.reopenScan(org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.Qualifier[][], org.apache.derby.iapi.types.DataValueDescriptor[], int)
public void reopenScanByRowLocation(RowLocation startRowLocation, Qualifier[][] qualifier) throws StandardException
reopenScanByRowLocation
in interface GenericScanController
startRowLocation
- 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
- 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.StandardException
- Standard exception policy.public boolean replace(DataValueDescriptor[] val, FormatableBitSet validColumns) throws StandardException
replace
in interface ScanController
StandardException
- Standard exception policy.ScanController.replace(org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.services.io.FormatableBitSet)
public RowLocation newRowLocationTemplate() throws StandardException
newRowLocationTemplate
in interface GenericScanController
StandardException
- Standard exception policy.GenericScanController.newRowLocationTemplate()
public boolean positionAtRowLocation(RowLocation rl) throws StandardException
ScanController
positionAtRowLocation
in interface ScanController
rl
- RowLocation for the new position for the scan. The
RowLocation submitted should be a RowLocation which has
previously been returned by this ScanController.StandardException
- Standard exception policy.ScanController.positionAtRowLocation(org.apache.derby.iapi.types.RowLocation)
public java.util.Properties getAllScanInfo(java.util.Properties prop) throws StandardException
This routine returns a list of properties which contains all information gathered about the scan. If a Property is passed in, then that property list is appeneded to, otherwise a new property object is created and returned.
Currently sort scans doesn't track any information.
getAllScanInfo
in interface ScanInfo
prop
- Property list to fill in.StandardException
- Standard exception policy.public boolean isHeldAfterCommit() throws StandardException
ScanController
isHeldAfterCommit
in interface ScanController
StandardException
- Standard exception policy.ScanController.isHeldAfterCommit()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.