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 BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate final GeneratedMethodprivate final booleanprivate longprivate final GeneratedMethodprivate longHolds the number of rows returned so far in this round of using the result set.private final boolean(package private) final NoPutResultSetprivate booleanTrue if we haven't yet fetched any rows from this result set.Fields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSetFields inherited from class BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArrayFields inherited from interface NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBERFields inherited from interface 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 voidClear 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().Gets information from sourceReturn the requested values computed from the next row (if any)Gets information from its source.longgetTimeSpent(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.booleanOverride 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...voidReopen 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 NoPutResultSetImpl
clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRowMethods inherited from class 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, toXMLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
openCorein 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:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein classBasicNoPutResultSetImpl- Throws:
StandardException- thrown if cursor finished.- See Also:
-
getNextRowCore
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:
-
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
Description 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:
-
finish
Description 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:
-
clearCurrentRow
public final void clearCurrentRow()Description copied from class:NoPutResultSetImplClear the current row- Specified by:
clearCurrentRowin interfaceResultSet- Overrides:
clearCurrentRowin classNoPutResultSetImpl- See Also:
-
getRowLocation
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:
-
getCurrentRow
Gets information from source- Specified by:
getCurrentRowin 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:
isForUpdatein interfaceNoPutResultSet- Overrides:
isForUpdatein 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.
-