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

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.ScanResultSet
              extended by org.apache.derby.impl.sql.execute.LastIndexKeyResultSet
All Implemented Interfaces:
NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource

 class LastIndexKeyResultSet
extends ScanResultSet

Return the last key in an index. Used to perform max().


Field Summary
 boolean coarserLock
           
protected  long conglomId
           
 java.lang.String indexName
           
protected  Qualifier[][] qualifiers
           
protected  GeneratedMethod resultRowAllocator
           
 boolean returnedRow
           
protected  boolean runTimeStatisticsOn
           
protected  GeneratedMethod startKeyGetter
           
protected  int startSearchOperator
           
protected  GeneratedMethod stopKeyGetter
           
 java.lang.String stopPositionString
           
protected  int stopSearchOperator
           
 java.lang.String tableName
           
 java.lang.String userSuppliedOptimizerOverrides
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.ScanResultSet
accessedCols, candidate, isolationLevel, lockMode
 
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
 
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
 
Constructor Summary
LastIndexKeyResultSet(Activation activation, int resultSetNumber, GeneratedMethod resultRowAllocator, long conglomId, java.lang.String tableName, java.lang.String userSuppliedOptimizerOverrides, java.lang.String indexName, int colRefItem, int lockMode, boolean tableLocked, int isolationLevel, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
          A last index key result set returns the last row from the index in question.
 
Method Summary
(package private)  boolean canGetInstantaneousLocks()
          Can we get instantaneous locks when getting share row locks at READ COMMITTED.
 void close()
          If the result set has been opened, close the open scan.
 ExecRow getCurrentRow()
          This result set has its row from the last fetch done.
 ExecRow getNextRowCore()
          Return the next row (if any) from the scan (if open).
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
 void openCore()
          open 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.ScanResultSet
getScanIsolationLevel, initIsolationLevel
 
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, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conglomId

protected long conglomId

resultRowAllocator

protected GeneratedMethod resultRowAllocator

startKeyGetter

protected GeneratedMethod startKeyGetter

startSearchOperator

protected int startSearchOperator

stopKeyGetter

protected GeneratedMethod stopKeyGetter

stopSearchOperator

protected int stopSearchOperator

qualifiers

protected Qualifier[][] qualifiers

tableName

public java.lang.String tableName

userSuppliedOptimizerOverrides

public java.lang.String userSuppliedOptimizerOverrides

indexName

public java.lang.String indexName

runTimeStatisticsOn

protected boolean runTimeStatisticsOn

stopPositionString

public java.lang.String stopPositionString

coarserLock

public boolean coarserLock

returnedRow

public boolean returnedRow
Constructor Detail

LastIndexKeyResultSet

public LastIndexKeyResultSet(Activation activation,
                             int resultSetNumber,
                             GeneratedMethod resultRowAllocator,
                             long conglomId,
                             java.lang.String tableName,
                             java.lang.String userSuppliedOptimizerOverrides,
                             java.lang.String indexName,
                             int colRefItem,
                             int lockMode,
                             boolean tableLocked,
                             int isolationLevel,
                             double optimizerEstimatedRowCount,
                             double optimizerEstimatedCost)
                      throws StandardException
A last index key result set returns the last row from the index in question. It is used as an ajunct to max().

Parameters:
activation - the activation for this result set, which provides the context for the row allocation operation.
resultSetNumber - The resultSetNumber for the ResultSet
resultRowAllocator - a reference to a method in the activation that creates a holder for the result row of the scan. May be a partial row. ExecRow rowAllocator() throws StandardException;
conglomId - the conglomerate of the table to be scanned.
tableName - The full name of the table
userSuppliedOptimizerOverrides - Overrides specified by the user on the sql
indexName - The name of the index, if one used to access table.
colRefItem - An saved item for a bitSet of columns that are referenced in the underlying table. -1 if no item.
lockMode - The lock granularity to use (see TransactionController in access)
tableLocked - Whether or not the table is marked as using table locking (in sys.systables)
isolationLevel - Isolation level (specified or not) to use on scans
optimizerEstimatedRowCount - Estimated total # of rows by optimizer
optimizerEstimatedCost - Estimated total cost by optimizer
Throws:
StandardException - thrown when unable to create the result set
Method Detail

canGetInstantaneousLocks

boolean canGetInstantaneousLocks()
Can we get instantaneous locks when getting share row locks at READ COMMITTED.

Specified by:
canGetInstantaneousLocks in class ScanResultSet

openCore

public void openCore()
              throws StandardException
open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Throws:
StandardException - thrown on failure to open

getNextRowCore

public ExecRow getNextRowCore()
                       throws StandardException
Return the next row (if any) from the scan (if open).

Specified by:
getNextRowCore in interface NoPutResultSet
Specified by:
getNextRowCore in class BasicNoPutResultSetImpl
Returns:
the next row in the result
Throws:
StandardException - thrown on failure to get next row
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 ScanResultSet
Throws:
StandardException - thrown on failure to close

getTimeSpent

public long getTimeSpent(int type)
Return the total amount of time spent in this 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).

getCurrentRow

public ExecRow getCurrentRow()
                      throws StandardException
This result set has its row from the last fetch done. If the cursor is closed, a null is returned.

Returns:
the last row returned;
Throws:
StandardException - thrown on failure.
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.