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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private final GeneratedMethod
private final boolean
private long
private final GeneratedMethod
private long
Holds the number of rows returned so far in this round of using the result set.private final boolean
(package private) final NoPutResultSet
private boolean
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
ConstructorsConstructorDescriptionRowCountResultSet
(NoPutResultSet s, Activation a, int resultSetNumber, GeneratedMethod offsetMethod, GeneratedMethod fetchFirstMethod, boolean hasJDBClimitClause, double optimizerEstimatedRowCount, double optimizerEstimatedCost) RowCountResultSet constructor -
Method Summary
Modifier and TypeMethodDescriptionfinal void
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().Gets information from sourceReturn the requested values computed from the next row (if any)Gets information from its source.long
getTimeSpent
(int type) Return the total amount of time spent in this ResultSetReturn underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.boolean
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
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 Details
-
source
-
runTimeStatsOn
private final boolean runTimeStatsOn -
offset
private long offset -
fetchFirst
private long fetchFirst -
offsetMethod
-
fetchFirstMethod
-
hasJDBClimitClause
private final boolean hasJDBClimitClause -
virginal
private boolean virginalTrue 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 rowsFetchedHolds 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 Details
-
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 Details
-
openCore
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
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:
-
getNextRowCore
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:
-
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
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:
-
finish
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:
-
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:
-
getRowLocation
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:
-
getCurrentRow
Gets information from source- Specified by:
getCurrentRow
in interfaceCursorResultSet
- Returns:
- the last row returned.
- Throws:
StandardException
- thrown on failure.- See Also:
-
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
Return underlying result set (the source og this result set) if it is a ProjectRestrictResultSet, else null.
-