Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv abstract Class ScanResultSet

extends NoPutResultSetImpl
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.execute.TableScanResultSet, org.apache.derby.impl.sql.execute.DependentResultSet, org.apache.derby.impl.sql.execute.HashScanResultSet, org.apache.derby.impl.sql.execute.LastIndexKeyResultSet
Imports
org.w3c.dom.Element, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.execute.ExecPreparedStatement, .ExecRow, .ExecRowBuilder, .ExecutionContext, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.transaction.TransactionControl, org.apache.derby.iapi.types.RowLocation

Abstract ResultSet class for NoPutResultSets which contain a scan. Returns rows that may be a column sub-set of the rows in the underlying object to be scanned. If accessedCols is not null then a sub-set of columns will be fetched from the underlying object (usually into the candidate row object), then the returned rows will be a compacted form of that row, with the not-fetched columns moved out. If accessedCols is null then the full row will be returned.
Example: if accessedCols indicates that we want to retrieve columns 1 and 4, then candidate row will have space for 5 columns (because that's the size of the rows in the underlying object), but only cols "1" and "4" will have values:
    0    1    2    3    4
 [  - , COL1,  - ,  - , COL4 ]
 

Rows returned by this ScanResultSet will have the values:
    0     1
 [ COL1, COL4 ]

Field Summary

Modifier and TypeField and Description
protected FormatableBitSet
accessedCols

If not null indicates the subset of columns that need to be pulled from the underlying object to be scanned.

pack-priv final ExecRow
candidate

The candidate row, matches the shape of the rows in the underlying object to be scanned.

protected boolean
fetchRowLocations

true if the scan should pick up row locations

public String
pack-priv int
isolationLevel

The scan isolation level.

private boolean
isolationLevelNeedsUpdate

Tells whether the isolation level needs to be updated.

pack-priv int
lockMode

The actual lock mode used.

pack-priv final ExecRowBuilder
resultRowBuilder

Object used to create and reset the candidate row.

private final int
suppliedLockMode

The lock mode supplied through the constructor.

private final boolean
tableLocked

If true, the table is marked as table locked in SYS.SYSTABLES.

public String
private final boolean
unspecifiedIsolationLevel

If true, the isolation level is unspecified and must be refreshed on each open.

Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
pack-priv
ScanResultSet(Activation
the activation
activation
,
int
number of the result set (unique within statement)
resultSetNumber
,
int
identifier of saved object for row template
resultRowTemplate
,
int
lock mode (record or table)
lockMode
,
boolean
true if marked as table locked in SYS.SYSTABLES
tableLocked
,
int
language isolation level for the result set
isolationLevel
,
int
Identifier of saved object for accessedCols, -1 if need to fetch all columns.
colRefItem
,
double
estimated row count
optimizerEstimatedRowCount
,
double
estimated cost
optimizerEstimatedCost
)

Construct a ScanResultSet.

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract boolean
canGetInstantaneousLocks()

Can we get instantaneous locks when getting share row locks at READ COMMITTED.

public void
private int

Returns:

lock mode
getLockMode
(int
the (language) isolation level
languageLevel
)

Get the lock mode based on the language isolation level.

public int
pack-priv void
initIsolationLevel()

Initialize the isolation level and the lock mode.

protected void
setRowLocationsState()

Determine whether this scan should return row locations

public Element
toXML(Element
Node to put content into.
parentNode
,
String
Element tag for content
tag
)

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.toXML.

Implements org.apache.derby.iapi.sql.ResultSet.toXML.

Produce an xml image of this ResultSet and its descendant ResultSets.

private int

Returns:

store isolation level
translateLanguageIsolationLevel
(int
language isolation level
languageLevel
)

Translate isolation level from language to store.

Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
clearCurrentRowclearOrderableCachecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsisForUpdatemarkRowAsDeletedneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValueupdateRow

Field Detail

accessedColsback to summary
protected FormatableBitSet accessedCols

If not null indicates the subset of columns that need to be pulled from the underlying object to be scanned. Set from the PreparedStatement's saved objects, if it exists.

candidateback to summary
pack-priv final ExecRow candidate

The candidate row, matches the shape of the rows in the underlying object to be scanned.

fetchRowLocationsback to summary
protected boolean fetchRowLocations

true if the scan should pick up row locations

indexNameback to summary
public String indexName
isolationLevelback to summary
pack-priv int isolationLevel

The scan isolation level.

isolationLevelNeedsUpdateback to summary
private boolean isolationLevelNeedsUpdate

Tells whether the isolation level needs to be updated.

lockModeback to summary
pack-priv int lockMode

The actual lock mode used.

resultRowBuilderback to summary
pack-priv final ExecRowBuilder resultRowBuilder

Object used to create and reset the candidate row.

suppliedLockModeback to summary
private final int suppliedLockMode

The lock mode supplied through the constructor.

tableLockedback to summary
private final boolean tableLocked

If true, the table is marked as table locked in SYS.SYSTABLES.

tableNameback to summary
public String tableName
unspecifiedIsolationLevelback to summary
private final boolean unspecifiedIsolationLevel

If true, the isolation level is unspecified and must be refreshed on each open.

Constructor Detail

ScanResultSetback to summary
pack-priv ScanResultSet(Activation activation, int resultSetNumber, int resultRowTemplate, int lockMode, boolean tableLocked, int isolationLevel, int colRefItem, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException

Construct a ScanResultSet.

Parameters
activation:Activation

the activation

resultSetNumber:int

number of the result set (unique within statement)

resultRowTemplate:int

identifier of saved object for row template

lockMode:int

lock mode (record or table)

tableLocked:boolean

true if marked as table locked in SYS.SYSTABLES

isolationLevel:int

language isolation level for the result set

colRefItem:int

Identifier of saved object for accessedCols, -1 if need to fetch all columns.

optimizerEstimatedRowCount:double

estimated row count

optimizerEstimatedCost:double

estimated cost

Method Detail

canGetInstantaneousLocksback to summary
pack-priv abstract boolean canGetInstantaneousLocks()

Can we get instantaneous locks when getting share row locks at READ COMMITTED.

closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close.

Implements org.apache.derby.iapi.sql.ResultSet.close.

Close the result set.

Exceptions
StandardException:
if an error occurs
getLockModeback to summary
private int getLockMode(int languageLevel)

Get the lock mode based on the language isolation level. Always do row locking unless the isolation level is serializable or the table is marked as table locked.

Parameters
languageLevel:int

the (language) isolation level

Returns:int

lock mode

getScanIsolationLevelback to summary
public int getScanIsolationLevel()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getScanIsolationLevel.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.getScanIsolationLevel.

Return the isolation level of the scan in the result set.

Returns:int

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.getScanIsolationLevel.

The isolation level of the scan (in TransactionController constants).

initIsolationLevelback to summary
pack-priv void initIsolationLevel()

Initialize the isolation level and the lock mode. If the result set was constructed with an explicit isolation level, or if the isolation level has already been initialized, this is a no-op. All sub-classes should invoke this method from their openCore() methods.

setRowLocationsStateback to summary
protected void setRowLocationsState() throws StandardException

Determine whether this scan should return row locations

toXMLback to summary
public Element toXML(Element parentNode, String tag) throws Exception

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.toXML.

Implements org.apache.derby.iapi.sql.ResultSet.toXML.

Doc from org.apache.derby.iapi.sql.ResultSet.toXML.

Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.

Parameters
parentNode:Element

Node to put content into.

tag:String

Element tag for content

Returns:Element

the content as an element with the given tag name

Exceptions
Exception:
on error
translateLanguageIsolationLevelback to summary
private int translateLanguageIsolationLevel(int languageLevel)

Translate isolation level from language to store.

Parameters
languageLevel:int

language isolation level

Returns:int

store isolation level