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

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

 class IndexRowToBaseRowResultSet
extends NoPutResultSetImpl
implements CursorResultSet

Takes a result set with a RowLocation as the last column, and uses the RowLocation to get and return a row from the given base conglomerate. Normally, the input result set will be a TableScanResultSet scanning an index conglomerate.


Field Summary
private  FormatableBitSet accessedAllCols
           
 FormatableBitSet accessedHeapCols
           
private  ConglomerateController baseCC
           
(package private)  RowLocation baseRowLocation
           
private  boolean closeBaseCCHere
           
(package private)  boolean copiedFromSource
           
protected  boolean currentRowPrescanned
           
private  DynamicCompiledOpenConglomInfo dcoci
           
private  boolean forUpdate
           
private  int[] indexCols
           
 java.lang.String indexName
           
private  GeneratedMethod restriction
           
 long restrictionTime
           
private  ExecRow resultRow
           
private  DataValueDescriptor[] rowArray
           
private  StaticCompiledOpenConglomInfo scoci
           
 NoPutResultSet source
           
private  boolean sourceIsForUpdateIndexScan
           
 
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
IndexRowToBaseRowResultSet(long conglomId, int scociItem, Activation a, NoPutResultSet source, GeneratedMethod resultRowAllocator, int resultSetNumber, java.lang.String indexName, int heapColRefItem, int allColRefItem, int heapOnlyColRefItem, int indexColMapItem, GeneratedMethod restriction, boolean forUpdate, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
           
 
Method Summary
 void close()
          If the result set has been opened, close the open scan.
 ExecRow getCurrentRow()
          Gets last row returned.
 ExecRow getNextRowCore()
          Return the requested values computed from the next row (if any) for which the restriction evaluates to true.
 RowLocation getRowLocation()
          Return the RowLocation of the base row.
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
 boolean isForUpdate()
          Is this ResultSet or it's source result set for update.
 void openCore()
          open this ResultSet.
 void positionScanAtRowLocation(RowLocation rl)
          Positions the cursor in the specified rowLocation.
 void reopenCore()
          reopen this ResultSet.
 
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, markRowAsDeleted, needsRowLocation, needsToClone, 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

restriction

private GeneratedMethod restriction

accessedHeapCols

public FormatableBitSet accessedHeapCols

accessedAllCols

private FormatableBitSet accessedAllCols

indexName

public java.lang.String indexName

indexCols

private int[] indexCols

dcoci

private DynamicCompiledOpenConglomInfo dcoci

scoci

private StaticCompiledOpenConglomInfo scoci

baseCC

private ConglomerateController baseCC

closeBaseCCHere

private boolean closeBaseCCHere

resultRow

private ExecRow resultRow

forUpdate

private boolean forUpdate

rowArray

private DataValueDescriptor[] rowArray

baseRowLocation

RowLocation baseRowLocation

copiedFromSource

boolean copiedFromSource

restrictionTime

public long restrictionTime

currentRowPrescanned

protected boolean currentRowPrescanned

sourceIsForUpdateIndexScan

private boolean sourceIsForUpdateIndexScan
Constructor Detail

IndexRowToBaseRowResultSet

IndexRowToBaseRowResultSet(long conglomId,
                           int scociItem,
                           Activation a,
                           NoPutResultSet source,
                           GeneratedMethod resultRowAllocator,
                           int resultSetNumber,
                           java.lang.String indexName,
                           int heapColRefItem,
                           int allColRefItem,
                           int heapOnlyColRefItem,
                           int indexColMapItem,
                           GeneratedMethod restriction,
                           boolean forUpdate,
                           double optimizerEstimatedRowCount,
                           double optimizerEstimatedCost)
                     throws StandardException
Throws:
StandardException
Method Detail

openCore

public void openCore()
              throws StandardException
open this ResultSet.

Specified by:
openCore in interface NoPutResultSet
Throws:
StandardException - thrown if cursor finished.

reopenCore

public void reopenCore()
                throws StandardException
reopen this ResultSet.

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
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.
StandardException - ResultSetNotOpen thrown if not yet open.
See Also:
NoPutResultSet.getNextRowCore()

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
Return the RowLocation of the base row.

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

positionScanAtRowLocation

public void positionScanAtRowLocation(RowLocation rl)
                               throws StandardException
Description copied from interface: NoPutResultSet
Positions the cursor in the specified rowLocation. Used for scrollable insensitive result sets in order to position the cursor back to a row that has already be visited.

Specified by:
positionScanAtRowLocation in interface NoPutResultSet
Overrides:
positionScanAtRowLocation in class NoPutResultSetImpl
Parameters:
rl - row location of the current cursor row
Throws:
StandardException - thrown on failure to get location from storage engine
See Also:
Also remembers row location so that subsequent invocations of getCurrentRow will not read the index row to look up the row location base row, but reuse the saved row location.

getCurrentRow

public ExecRow getCurrentRow()
                      throws StandardException
Gets last row returned.

Specified by:
getCurrentRow in interface CursorResultSet
Returns:
the last row returned.
Throws:
StandardException - thrown on failure.
See Also:
CursorResultSet

isForUpdate

public boolean isForUpdate()
Is this ResultSet or it's source result set for update. beetle 3865: updateable cursor using index scan. We didn't need this function before because we couldn't use index for update cursor.

Specified by:
isForUpdate in interface NoPutResultSet
Overrides:
isForUpdate in class NoPutResultSetImpl
Returns:
Whether or not the result set is for update.

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

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