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

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.MaterializedResultSet
All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource

 class MaterializedResultSet
extends NoPutResultSetImpl
implements CursorResultSet

Materialize the underlying ResultSet tree into a temp table on the 1st open. Return rows from temp table on subsequent scans.


Field Summary
 long createTCTime
           
 long fetchTCTime
           
private  boolean fromSource
           
protected  ConglomerateController materializedCC
           
protected  long materializedCID
           
 boolean materializedCreated
           
private  ExecRow materializedRowBuffer
           
protected  ScanController materializedScan
           
 NoPutResultSet source
           
private  boolean sourceDrained
           
private  TransactionController tc
           
 
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
MaterializedResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
          Constructor for a MaterializedResultSet
 
Method Summary
 void close()
          If the result set has been opened, close the open scan.
 ExecRow getCurrentRow()
          Gets information from last getNextRow call.
 ExecRow getNextRowCore()
          Return the requested values computed from the next row (if any) for which the restriction evaluates to true.
private  ExecRow getNextRowFromSource()
           
private  ExecRow getNextRowFromTempTable()
           
 RowLocation getRowLocation()
          Gets information from its source.
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
 void openCore()
          open a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values...
 void reopenCore()
          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
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, finish, 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, 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, finish, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow
 

Field Detail

source

public NoPutResultSet source

materializedRowBuffer

private ExecRow materializedRowBuffer

materializedCID

protected long materializedCID

materializedCreated

public boolean materializedCreated

fromSource

private boolean fromSource

materializedCC

protected ConglomerateController materializedCC

materializedScan

protected ScanController materializedScan

tc

private TransactionController tc

sourceDrained

private boolean sourceDrained

createTCTime

public long createTCTime

fetchTCTime

public long fetchTCTime
Constructor Detail

MaterializedResultSet

public MaterializedResultSet(NoPutResultSet source,
                             Activation activation,
                             int resultSetNumber,
                             double optimizerEstimatedRowCount,
                             double optimizerEstimatedCost)
                      throws StandardException
Constructor for a MaterializedResultSet

Parameters:
source - The NoPutResultSet from which to get rows to be materialized
activation - The activation for this execution
resultSetNumber - The resultSetNumber
Throws:
StandardException - on error
Method Detail

openCore

public void openCore()
              throws StandardException
open a scan on the source. 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 failure

reopenCore

public void reopenCore()
                throws StandardException
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 interface NoPutResultSet
Overrides:
reopenCore in class BasicNoPutResultSetImpl
Throws:
StandardException - thrown if cursor finished.
See Also:
NoPutResultSet.openCore()

getNextRowCore

public ExecRow getNextRowCore()
                       throws StandardException
Description copied from interface: NoPutResultSet
Return the requested values computed from the next row (if any) for which the restriction evaluates to true.

restriction and projection parameters are evaluated for each row.

Specified by:
getNextRowCore in interface NoPutResultSet
Specified by:
getNextRowCore in class BasicNoPutResultSetImpl
Returns:
the next row in the result
Throws:
StandardException - thrown on failure
See Also:
NoPutResultSet.getNextRowCore()

getNextRowFromSource

private ExecRow getNextRowFromSource()
                              throws StandardException
Throws:
StandardException

getNextRowFromTempTable

private ExecRow getNextRowFromTempTable()
                                 throws StandardException
Throws:
StandardException

close

public void close()
           throws StandardException
If the result set has been opened, close the open scan.

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

getTimeSpent

public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet

Specified by:
getTimeSpent in interface ResultSet
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

public RowLocation getRowLocation()
                           throws StandardException
Gets information from its source. We might want to have this take a CursorResultSet in its constructor some day, instead of doing a cast here?

Specified by:
getRowLocation in interface CursorResultSet
Returns:
the row location of the current cursor row.
Throws:
StandardException - thrown on failure
See Also:
CursorResultSet

getCurrentRow

public ExecRow getCurrentRow()
Gets information from last getNextRow call.

Specified by:
getCurrentRow in interface CursorResultSet
Returns:
the last row returned.
See Also:
CursorResultSet

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.