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 longfetchFirstprivate GeneratedMethodfetchFirstMethodprivate booleanhasJDBClimitClauseprivate longoffsetprivate GeneratedMethodoffsetMethodprivate longrowsFetchedHolds the number of rows returned so far in this round of using the result set.private booleanrunTimeStatsOn(package private) NoPutResultSetsourceprivate booleanvirginalTrue 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 voidclearCurrentRow()Clear the current rowvoidclose()Close needs to invalidate any dependent statements, if this is a cursor.voidfinish()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().ExecRowgetCurrentRow()Gets information from sourceExecRowgetNextRowCore()Return the requested values computed from the next row (if any)RowLocationgetRowLocation()Gets information from its source.longgetTimeSpent(int type)Return the total amount of time spent in this ResultSetProjectRestrictResultSetgetUnderlyingProjectRestrictRS()Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.booleanisForUpdate()Override of NoPutResultSetImpl method.voidopenCore()Open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...voidreopenCore()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 StandardExceptionOpen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown if cursor finished.
-
reopenCore
public void reopenCore() throws StandardExceptionReopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein 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:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein 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:
getTimeSpentin 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 StandardExceptionDescription copied from class:NoPutResultSetImplClose needs to invalidate any dependent statements, if this is a cursor. Must be called by any subclasses that override close().- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- on error- See Also:
ResultSet.close()
-
finish
public void finish() throws StandardExceptionDescription copied from interface:ResultSetTells 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:
finishin interfaceResultSet- Overrides:
finishin classBasicNoPutResultSetImpl- Throws:
StandardException- on error- See Also:
ResultSet.finish()
-
clearCurrentRow
public final void clearCurrentRow()
Description copied from class:NoPutResultSetImplClear the current row- Specified by:
clearCurrentRowin interfaceResultSet- Overrides:
clearCurrentRowin classNoPutResultSetImpl- See Also:
ResultSet.clearCurrentRow()
-
getRowLocation
public RowLocation getRowLocation() throws StandardException
Gets information from its source.- Specified by:
getRowLocationin 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:
getCurrentRowin 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:
isForUpdatein interfaceNoPutResultSet- Overrides:
isForUpdatein 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.
-
-