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 org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
int
int
private int
private int
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
ConstructorsConstructorDescriptionUnionResultSet
(NoPutResultSet source1, NoPutResultSet source2, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
If the result set has been opened, close the currently open source.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().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.long
getTimeSpent
(int type) Return the total amount of time spent in this ResultSetvoid
openCore()
open the first source.Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getValidColumns, isForUpdate, 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, reopenCore, 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, 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:
getResultDescription
in interfaceResultSet
- Overrides:
getResultDescription
in classNoPutResultSetImpl
- Returns:
- A ResultDescription describing the results of the statement.
-
openCore
open the first source.- Specified by:
openCore
in 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:
getNextRowCore
in interfaceNoPutResultSet
- Specified by:
getNextRowCore
in 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:
close
in interfaceResultSet
- Overrides:
close
in classNoPutResultSetImpl
- Throws:
StandardException
- thrown on error
-
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
-
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).
-
getRowLocation
A union has a single underlying row at a time, although from one of several sources.- Specified by:
getRowLocation
in 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:
getCurrentRow
in interfaceCursorResultSet
- Returns:
- the current row.
- Throws:
StandardException
- thrown on failure.- See Also:
-