Class RowCountResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.RowCountResultSet
-
- All Implemented Interfaces:
CursorResultSet
,NoPutResultSet
,ResultSet
,RowLocationRetRowSource
,RowSource
class RowCountResultSet extends NoPutResultSetImpl implements CursorResultSet
This result set implements the filtering of rows needed for theand 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
-
Field Summary
Fields Modifier and Type Field Description private long
fetchFirst
private GeneratedMethod
fetchFirstMethod
private boolean
hasJDBClimitClause
private long
offset
private GeneratedMethod
offsetMethod
private long
rowsFetched
Holds the number of rows returned so far in this round of using the result set.private boolean
runTimeStatsOn
(package private) NoPutResultSet
source
private boolean
virginal
True if we haven't yet fetched any rows from this result set.-
Fields inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSet
-
Fields inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
-
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
-
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
-
-
Constructor Summary
Constructors Constructor Description RowCountResultSet(NoPutResultSet s, Activation a, int resultSetNumber, GeneratedMethod offsetMethod, GeneratedMethod fetchFirstMethod, boolean hasJDBClimitClause, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
RowCountResultSet constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCurrentRow()
Clear the current rowvoid
close()
Close needs to invalidate any dependent statements, if this is a cursor.void
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().ExecRow
getCurrentRow()
Gets information from sourceExecRow
getNextRowCore()
Return the requested values computed from the next row (if any)RowLocation
getRowLocation()
Gets information from its source.long
getTimeSpent(int type)
Return the total amount of time spent in this ResultSetProjectRestrictResultSet
getUnderlyingProjectRestrictRS()
Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.boolean
isForUpdate()
Override of NoPutResultSetImpl method.void
openCore()
Open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...void
reopenCore()
Reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...-
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRow
-
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXML, toXML
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
addWarning, checkRowPosition, cleanUp, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
-
-
-
Field Detail
-
source
final NoPutResultSet source
-
runTimeStatsOn
private final boolean runTimeStatsOn
-
offset
private long offset
-
fetchFirst
private long fetchFirst
-
offsetMethod
private final GeneratedMethod offsetMethod
-
fetchFirstMethod
private final GeneratedMethod fetchFirstMethod
-
hasJDBClimitClause
private final boolean hasJDBClimitClause
-
virginal
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.
-
rowsFetched
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.
-
-
Constructor Detail
-
RowCountResultSet
RowCountResultSet(NoPutResultSet s, Activation a, int resultSetNumber, GeneratedMethod offsetMethod, GeneratedMethod fetchFirstMethod, boolean hasJDBClimitClause, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException
RowCountResultSet constructor- Parameters:
s
- The source result set being filtereda
- The activation for this result set, which provides the context for the row allocation operationresultSetNumber
- The resultSetNumber for the ResultSetoffsetMethod
- Generated methodfetchFirstMethod
- Generated methodhasJDBClimitClause
- True if offset/fetchFirst clauses were added by JDBC LIMIT escape syntaxoptimizerEstimatedRowCount
- Estimated total # of rows by optimizeroptimizerEstimatedCost
- Estimated total cost by optimizer- Throws:
StandardException
- Standard error policy
-
-
Method Detail
-
openCore
public void openCore() throws StandardException
Open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
openCore
in interfaceNoPutResultSet
- Throws:
StandardException
- thrown if cursor finished.
-
reopenCore
public void reopenCore() throws StandardException
Reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
reopenCore
in interfaceNoPutResultSet
- Overrides:
reopenCore
in classBasicNoPutResultSetImpl
- Throws:
StandardException
- thrown if cursor finished.- See Also:
NoPutResultSet.openCore()
-
getNextRowCore
public ExecRow getNextRowCore() throws StandardException
Return the requested values computed from the next row (if any)- Specified by:
getNextRowCore
in interfaceNoPutResultSet
- Specified by:
getNextRowCore
in classBasicNoPutResultSetImpl
- Returns:
- the next row in the result
- Throws:
StandardException
- thrown on failure.StandardException
- ResultSetNotOpen thrown if not yet open.- See Also:
NoPutResultSet.getNextRowCore()
-
getTimeSpent
public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpent
in interfaceResultSet
- Parameters:
type
- CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.- Returns:
- long The total amount of time spent (in milliseconds).
-
close
public void close() throws StandardException
Description copied from class:NoPutResultSetImpl
Close needs to invalidate any dependent statements, if this is a cursor. Must be called by any subclasses that override close().- Specified by:
close
in interfaceResultSet
- Overrides:
close
in classNoPutResultSetImpl
- Throws:
StandardException
- on error- See Also:
ResultSet.close()
-
finish
public void finish() throws StandardException
Description copied from interface:ResultSet
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.- Specified by:
finish
in interfaceResultSet
- Overrides:
finish
in classBasicNoPutResultSetImpl
- Throws:
StandardException
- on error- See Also:
ResultSet.finish()
-
clearCurrentRow
public final void clearCurrentRow()
Description copied from class:NoPutResultSetImpl
Clear the current row- Specified by:
clearCurrentRow
in interfaceResultSet
- Overrides:
clearCurrentRow
in classNoPutResultSetImpl
- See Also:
ResultSet.clearCurrentRow()
-
getRowLocation
public RowLocation getRowLocation() throws StandardException
Gets information from its source.- Specified by:
getRowLocation
in interfaceCursorResultSet
- Returns:
- the row location of the current cursor row.
- Throws:
StandardException
- thrown on failure to get location from storage engine- See Also:
CursorResultSet.getRowLocation()
-
getCurrentRow
public ExecRow getCurrentRow() throws StandardException
Gets information from source- Specified by:
getCurrentRow
in interfaceCursorResultSet
- Returns:
- the last row returned.
- Throws:
StandardException
- thrown on failure.- See Also:
CursorResultSet.getCurrentRow()
-
isForUpdate
public boolean isForUpdate()
Override of NoPutResultSetImpl method. Ask the source.- Specified by:
isForUpdate
in interfaceNoPutResultSet
- Overrides:
isForUpdate
in classNoPutResultSetImpl
- Returns:
- Whether or not the result set is for update.
-
getUnderlyingProjectRestrictRS
public ProjectRestrictResultSet getUnderlyingProjectRestrictRS()
Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.
-
-