Class UnionResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.UnionResultSet
- All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
Takes two result sets and returns their union (all).
(Any duplicate elimination is performed above this ResultSet.)
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionintintintprivate intprivate intFields 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
ConstructorsConstructorDescriptionUnionResultSet(NoPutResultSet source1, NoPutResultSet source2, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()If the result set has been opened, close the currently open source.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().A union has a single underlying row at a time, although from one of several sources.If there are rows still on the first source, return the next one; otherwise, switch to the second source and return a row from there.Returns the description of the first source.A union has a single underlying row at a time, although from one of several sources.longgetTimeSpent(int type) Return the total amount of time spent in this ResultSetvoidopenCore()open the first source.Methods inherited from class NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getValidColumns, isForUpdate, 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, reopenCore, 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, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
Field Details
-
rowsSeenLeft
public int rowsSeenLeft -
rowsSeenRight
public int rowsSeenRight -
rowsReturned
public int rowsReturned -
whichSource
private int whichSource -
source1FinalRowCount
private int source1FinalRowCount -
source1
-
source2
-
-
Constructor Details
-
UnionResultSet
public UnionResultSet(NoPutResultSet source1, NoPutResultSet source2, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
-
-
Method Details
-
getResultDescription
Returns the description of the first source. Assumes the compiler ensured both sources had the same description.- Specified by:
getResultDescriptionin interfaceResultSet- Overrides:
getResultDescriptionin classNoPutResultSetImpl- Returns:
- A ResultDescription describing the results of the statement.
-
openCore
open the first source.- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown on failure
-
getNextRowCore
If there are rows still on the first source, return the next one; otherwise, switch to the second source and return a row from there.- Specified by:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein classBasicNoPutResultSetImpl- Returns:
- the next row in the result
- Throws:
StandardException- thrown on failure- See Also:
-
close
If the result set has been opened, close the currently open source.- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- thrown on error
-
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
-
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).
-
getRowLocation
A union has a single underlying row at a time, although from one of several sources.- Specified by:
getRowLocationin interfaceCursorResultSet- Returns:
- the row location of the current cursor row.
- Throws:
StandardException- thrown on failure- See Also:
-
getCurrentRow
A union has a single underlying row at a time, although from one of several sources.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- the current row.
- Throws:
StandardException- thrown on failure.- See Also:
-