org.apache.derby.impl.sql.execute
Class JoinResultSet

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
      extended by org.apache.derby.impl.sql.execute.NoPutResultSetImpl
          extended by org.apache.derby.impl.sql.execute.JoinResultSet
All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
Direct Known Subclasses:
MergeJoinResultSet, NestedLoopJoinResultSet

abstract class JoinResultSet
extends NoPutResultSetImpl
implements CursorResultSet

Takes 2 NoPutResultSets and a join filter and returns the join's rows satisfying the filter as a result set.


Field Summary
protected  boolean isRightOpen
           
protected  int leftNumCols
           
 NoPutResultSet leftResultSet
           
protected  ExecRow leftRow
           
protected  ExecRow mergedRow
           
 boolean notExistsRightSide
           
 boolean oneRowRightSide
           
protected  GeneratedMethod restriction
           
 long restrictionTime
           
protected  int rightNumCols
           
 NoPutResultSet rightResultSet
           
protected  ExecRow rightRow
           
 int rowsReturned
           
 int rowsSeenLeft
           
 int rowsSeenRight
           
(package private)  java.lang.String userSuppliedOptimizerOverrides
           
 
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.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE
 
Constructor Summary
JoinResultSet(NoPutResultSet leftResultSet, int leftNumCols, NoPutResultSet rightResultSet, int rightNumCols, Activation activation, GeneratedMethod restriction, int resultSetNumber, boolean oneRowRightSide, boolean notExistsRightSide, double optimizerEstimatedRowCount, double optimizerEstimatedCost, java.lang.String userSuppliedOptimizerOverrides)
           
 
Method Summary
(package private)  void clearScanState()
          Clear any private state that changes during scans.
 void close()
          If the result set has been opened, close the open scan.
protected  void closeRight()
          close the rightResultSet
 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().
 ExecRow getCurrentRow()
          A join is combining rows from two sources, so it should never be used in a positioned update or delete.
 RowLocation getRowLocation()
          A join is combining rows from two sources, so it has no single row location to return; just return a null.
 void openCore()
          open a scan on the join.
protected  void openRight()
          open the rightResultSet.
 void reopenCore()
          reopen a a join.
 
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsToClone, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, updateRow
 
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getNextRowCore, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow
 
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
checkRowPosition, cleanUp, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow
 

Field Detail

rowsSeenLeft

public int rowsSeenLeft

rowsSeenRight

public int rowsSeenRight

rowsReturned

public int rowsReturned

restrictionTime

public long restrictionTime

isRightOpen

protected boolean isRightOpen

leftRow

protected ExecRow leftRow

rightRow

protected ExecRow rightRow

mergedRow

protected ExecRow mergedRow

leftResultSet

public NoPutResultSet leftResultSet

leftNumCols

protected int leftNumCols

rightResultSet

public NoPutResultSet rightResultSet

rightNumCols

protected int rightNumCols

restriction

protected GeneratedMethod restriction

oneRowRightSide

public boolean oneRowRightSide

notExistsRightSide

public boolean notExistsRightSide

userSuppliedOptimizerOverrides

java.lang.String userSuppliedOptimizerOverrides
Constructor Detail

JoinResultSet

JoinResultSet(NoPutResultSet leftResultSet,
              int leftNumCols,
              NoPutResultSet rightResultSet,
              int rightNumCols,
              Activation activation,
              GeneratedMethod restriction,
              int resultSetNumber,
              boolean oneRowRightSide,
              boolean notExistsRightSide,
              double optimizerEstimatedRowCount,
              double optimizerEstimatedCost,
              java.lang.String userSuppliedOptimizerOverrides)
Method Detail

clearScanState

void clearScanState()
Clear any private state that changes during scans. This includes things like the last row seen, etc. THis does not include immutable things that are typically set up in the constructor.

This method is called on open()/close() and reopen()


openCore

public void openCore()
              throws StandardException
open a scan on the join. For a join, this means: o Open the left ResultSet o Do a getNextRow() on the left ResultSet to establish a position and get "parameter values" for the right ResultSet. NOTE: It is possible for the getNextRow() to return null, in which case there is no need to open the RightResultSet. We must remember this condition. o If the getNextRow() on the left ResultSet succeeded, then open() the right ResultSet. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Specified by:
openCore in interface NoPutResultSet
Throws:
StandardException - Thrown on error

reopenCore

public void reopenCore()
                throws StandardException
reopen a a join.

Specified by:
reopenCore in interface NoPutResultSet
Overrides:
reopenCore in class BasicNoPutResultSetImpl
Throws:
StandardException - thrown if cursor finished.
See Also:
NoPutResultSet.openCore()

close

public void close()
           throws StandardException
If the result set has been opened, close the open scan. WARNING does not track close time, since it is expected to be called directly by its subclasses, and we don't want to skew the times

Specified by:
close in interface ResultSet
Overrides:
close in class NoPutResultSetImpl
Throws:
StandardException - thrown on error

finish

public void finish()
            throws StandardException
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 interface ResultSet
Overrides:
finish in class BasicNoPutResultSetImpl
Throws:
StandardException - on error

getRowLocation

public RowLocation getRowLocation()
A join is combining rows from two sources, so it has no single row location to return; just return a null.

Specified by:
getRowLocation in interface CursorResultSet
Returns:
the row location of the current cursor row.
See Also:
CursorResultSet

getCurrentRow

public ExecRow getCurrentRow()
A join is combining rows from two sources, so it should never be used in a positioned update or delete.

Specified by:
getCurrentRow in interface CursorResultSet
Returns:
a null value.
See Also:
CursorResultSet

openRight

protected void openRight()
                  throws StandardException
open the rightResultSet. If already open, just reopen.

Throws:
StandardException - Thrown on error

closeRight

protected void closeRight()
                   throws StandardException
close the rightResultSet

Throws:
StandardException

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.