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

pack-priv Class RowCountResultSet

extends NoPutResultSetImpl
implements CursorResultSet
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.ResultSet
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.sql.conn.StatementContext, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecRow, .NoPutResultSet, org.apache.derby.iapi.sql.Activation, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.iapi.types.RowLocation, .DataValueDescriptor

This result set implements the filtering of rows needed for the and the . It sits on top of the normal SELECT's top result set, but under any ScrollInsensitiveResultSet needed for cursors. The latter positioning is needed for the correct functioning of and in the presence of scrollable and/or updatable result sets and CURRENT OF cursors. It is only ever generated if at least one of the two clauses is present.

Field Summary

Modifier and TypeField and Description
private long
private final GeneratedMethod
private final boolean
private long
private final GeneratedMethod
private long
rowsFetched

Holds the number of rows returned so far in this round of using the result set.

private final boolean
pack-priv final NoPutResultSet
private boolean
virginal

True if we haven't yet fetched any rows from this result set.

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

Constructor Summary

AccessConstructor and Description
pack-priv
RowCountResultSet(NoPutResultSet
The source result set being filtered
s
,
Activation
The activation for this result set, which provides the context for the row allocation operation
a
,
int
The resultSetNumber for the ResultSet
resultSetNumber
,
GeneratedMethod
Generated method
offsetMethod
,
GeneratedMethod
Generated method
fetchFirstMethod
,
boolean
True if offset/fetchFirst clauses were added by JDBC LIMIT escape syntax
hasJDBClimitClause
,
double
Estimated total # of rows by optimizer
optimizerEstimatedRowCount
,
double
Estimated total cost by optimizer
optimizerEstimatedCost
)

RowCountResultSet constructor

Method Summary

Modifier and TypeMethod and Description
public final void
public void
close()

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

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

Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.

public void
finish()

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

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

Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open().

public ExecRow

Returns:

the last row returned.
getCurrentRow
()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Gets information from source

public ExecRow

Returns:

the next row in the result
getNextRowCore
()

Implements abstract org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRowCore.

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

Return the requested values computed from the next row (if any)

public RowLocation
public long

Returns:

long The total amount of time spent (in milliseconds).
getTimeSpent
(int
CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.
type
)

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

Return the total amount of time spent in this ResultSet

public ProjectRestrictResultSet
getUnderlyingProjectRestrictRS()

Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.

public boolean
public void
public void
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
clearOrderableCachecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsmarkRowAsDeletedneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValueupdateRow

Field Detail

fetchFirstback to summary
private long fetchFirst
fetchFirstMethodback to summary
private final GeneratedMethod fetchFirstMethod
hasJDBClimitClauseback to summary
private final boolean hasJDBClimitClause
offsetback to summary
private long offset
offsetMethodback to summary
private final GeneratedMethod offsetMethod
rowsFetchedback to summary
private long rowsFetched

Holds the number of rows returned so far in this round of using the result set. Will be reset on close so the result set is ready to reuse.

runTimeStatsOnback to summary
private final boolean runTimeStatsOn
sourceback to summary
pack-priv final NoPutResultSet source
virginalback to summary
private boolean virginal

True if we haven't yet fetched any rows from this result set. Will be reset on close so the result set is ready to reuse.

Constructor Detail

RowCountResultSetback to summary
pack-priv RowCountResultSet(NoPutResultSet s, Activation a, int resultSetNumber, GeneratedMethod offsetMethod, GeneratedMethod fetchFirstMethod, boolean hasJDBClimitClause, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException

RowCountResultSet constructor

Parameters
s:NoPutResultSet

The source result set being filtered

a:Activation

The activation for this result set, which provides the context for the row allocation operation

resultSetNumber:int

The resultSetNumber for the ResultSet

offsetMethod:GeneratedMethod

Generated method

fetchFirstMethod:GeneratedMethod

Generated method

hasJDBClimitClause:boolean

True if offset/fetchFirst clauses were added by JDBC LIMIT escape syntax

optimizerEstimatedRowCount:double

Estimated total # of rows by optimizer

optimizerEstimatedCost:double

Estimated total cost by optimizer

Exceptions
StandardException:
Standard error policy

Method Detail

clearCurrentRowback to summary
public final void clearCurrentRow()

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

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

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

Clear the current row. The cursor keeps it current position, however it cannot be used for positioned updates or deletes until a fetch is done. This is done after a commit on holdable result sets. A fetch is achieved by calling one of the positioning methods: getLastRow(), getNextRow(), getPreviousRow(), getFirstRow(), getRelativeRow(..) or getAbsoluteRow(..).

See Also
org.apache.derby.iapi.sql.ResultSet#clearCurrentRow
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.

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

Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.

Exceptions
StandardException:
Thrown on error.
See Also
org.apache.derby.iapi.sql.ResultSet#close
finishback to summary
public void finish() throws StandardException

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

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

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

Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open(). Will close the result set if it is not already closed.

Exceptions
StandardException:
on error
See Also
org.apache.derby.iapi.sql.ResultSet#finish
getCurrentRowback to summary
public ExecRow getCurrentRow() throws StandardException

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Gets information from source

Returns:ExecRow

the last row returned.

Exceptions
StandardException:

Doc from org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

thrown on failure.

See Also
org.apache.derby.iapi.sql.execute.CursorResultSet#getCurrentRow
getNextRowCoreback to summary
public ExecRow getNextRowCore() throws StandardException

Implements abstract org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRowCore.

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

Return the requested values computed from the next row (if any)

Returns:ExecRow

the next row in the result

Exceptions
StandardException:
  • thrown on failure.
  • ResultSetNotOpen thrown if not yet open.
getRowLocationback to summary
public RowLocation getRowLocation() throws StandardException

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Gets information from its source.

Returns:RowLocation

Doc from org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

the row location of the current cursor row.

Exceptions
StandardException:

Doc from org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

thrown on failure to get location from storage engine

See Also
org.apache.derby.iapi.sql.execute.CursorResultSet#getRowLocation
getTimeSpentback to summary
public long getTimeSpent(int type)

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

Return the total amount of time spent in this ResultSet

Parameters
type:int

CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.

Returns:long

long The total amount of time spent (in milliseconds).

getUnderlyingProjectRestrictRSback to summary
public ProjectRestrictResultSet getUnderlyingProjectRestrictRS()

Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.

isForUpdateback to summary
public boolean isForUpdate()

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

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

Override of NoPutResultSetImpl method. Ask the source.

Returns:boolean

Doc from org.apache.derby.impl.sql.execute.NoPutResultSetImpl.isForUpdate.

Whether or not the result set is for update.

openCoreback to summary
public void openCore() throws StandardException

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

Open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Exceptions
StandardException:
thrown if cursor finished.
reopenCoreback to summary
public void reopenCore() throws StandardException

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

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

Reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Exceptions
StandardException:
thrown if cursor finished.