Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.sql.execute
Class BulkTableScanResultSet  view BulkTableScanResultSet download BulkTableScanResultSet.java

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
      extended byorg.apache.derby.impl.sql.execute.NoPutResultSetImpl
          extended byorg.apache.derby.impl.sql.execute.TableScanResultSet
              extended byorg.apache.derby.impl.sql.execute.BulkTableScanResultSet
All Implemented Interfaces:
java.lang.Cloneable, org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.execute.NoPutResultSet, org.apache.derby.iapi.sql.ResultSet, org.apache.derby.iapi.store.access.RowLocationRetRowSource, org.apache.derby.iapi.store.access.RowSource

public class BulkTableScanResultSet
extends TableScanResultSet
implements org.apache.derby.iapi.sql.execute.CursorResultSet

Read a base table or index in bulk. Most of the work for this method is inherited from TableScanResultSet. This class overrides getNextRowCore (and extends re/openCore) to use a row array and fetch rows from the Store in bulk (using fetchNextGroup).

Since it retrieves rows in bulk, locking is not as is usual -- locks may have already been released on rows as they are returned to the user. Hence, this ResultSet is not suitable for a query running Isolation Level 1, cursor stability.

Note that this code is only accessable from an optimizer override. If it makes sense to have the optimizer select bulk reads, then this should probably be rolled into TableScanResultSet.


Field Summary
private  int curRowPosition
           
private  int numRowsInArray
           
private static int OUT_OF_ROWS
           
private  org.apache.derby.iapi.types.DataValueDescriptor[][] rowArray
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.TableScanResultSet
accessedCols, activation, beginTime, candidate, checkGM, checkNullCols, clonedExecRow, closeCleanup, closeTime, cncLen, coarserLock, compactRow, compareToLastKey, conglomId, constructorTime, currentRow, currentRowPrescanned, dcoci, endExecutionTime, finished, firstScan, forUpdate, futureForUpdateRows, futureRowResultSet, heapConglomerate, indent, indexCols, indexName, isConstraint, isKeyed, isolationLevel, isOpen, isTopResultSet, lastCursorKey, lcc, lockMode, nextTime, numOpens, oneRowScan, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, past2FutureTbl, qualifiers, resultDescription, resultRowAllocator, resultSetNumber, rowsFiltered, rowsPerRead, rowsSeen, rowsThisScan, runTimeStatisticsOn, scanController, scanControllerOpened, scoci, skipFutureRowHolder, sourceDepth, sourceDrained, startExecutionTime, startKeyGetter, startPosition, startPositionString, startSearchOperator, stopKeyGetter, stopPosition, stopPositionString, stopSearchOperator, subIndent, subqueryTrackingArray, tableName, targetResultSet
 
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
BulkTableScanResultSet(long conglomId, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo scoci, org.apache.derby.iapi.sql.Activation activation, org.apache.derby.iapi.services.loader.GeneratedMethod resultRowAllocator, int resultSetNumber, org.apache.derby.iapi.services.loader.GeneratedMethod startKeyGetter, int startSearchOperator, org.apache.derby.iapi.services.loader.GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, org.apache.derby.iapi.store.access.Qualifier[][] qualifiers, java.lang.String tableName, java.lang.String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int rowsPerRead, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost, org.apache.derby.iapi.services.loader.GeneratedMethod closeCleanup)
          Constructor.
 
Method Summary
protected  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.
 org.apache.derby.iapi.sql.execute.ExecRow getNextRowCore()
          Return the next row (if any) from the scan (if open).
 void openCore()
          Open up the result set.
protected  void openScanController(org.apache.derby.iapi.store.access.TransactionController tc)
          Open the scan controller
private  int reloadArray()
           
 void reopenCore()
          Reopen the result set.
 boolean requiresRelocking()
          Do we need to relock the row when going to the heap.
 
Methods inherited from class org.apache.derby.impl.sql.execute.TableScanResultSet
addWarning, attachStatementContext, checkRowPosition, cleanUp, clearCurrentRow, clearOrderableCache, clone, closeRowSource, dumpTimeStats, finish, finishAndRTS, getAbsoluteRow, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentRow, getCurrentTimeMillis, getCursorName, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getNextRowFromRowSource, getPointOfAttachment, getPreviousRow, getRelativeRow, getResultDescription, getRowLocation, getRowNumber, getScanIsolationLevel, getScanProperties, getSubqueryTrackingArray, getTimeSpent, getTransactionController, getValidColumns, getWarnings, isClosed, isForUpdate, markAsTopResultSet, modifiedRowCount, needsRowLocation, needsToClone, open, printQualifiers, printStartPosition, printStopPosition, resultSetNumber, returnsRows, rowLocation, setAfterLastRow, setBeforeFirstRow, setCheckConstraints, setCompactRow, setCompatRow, setCurrentRow, setHeapConglomerate, setNeedsRowLocation, setRowCountIfPossible, setTargetResultSet, skipRow, skipScan
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.execute.CursorResultSet
getCurrentRow, getRowLocation
 
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
checkRowPosition, cleanUp, finish, getAbsoluteRow, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow
 

Field Detail

rowArray

private org.apache.derby.iapi.types.DataValueDescriptor[][] rowArray

curRowPosition

private int curRowPosition

numRowsInArray

private int numRowsInArray

OUT_OF_ROWS

private static int OUT_OF_ROWS
Constructor Detail

BulkTableScanResultSet

public BulkTableScanResultSet(long conglomId,
                              org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo scoci,
                              org.apache.derby.iapi.sql.Activation activation,
                              org.apache.derby.iapi.services.loader.GeneratedMethod resultRowAllocator,
                              int resultSetNumber,
                              org.apache.derby.iapi.services.loader.GeneratedMethod startKeyGetter,
                              int startSearchOperator,
                              org.apache.derby.iapi.services.loader.GeneratedMethod stopKeyGetter,
                              int stopSearchOperator,
                              boolean sameStartStopPosition,
                              org.apache.derby.iapi.store.access.Qualifier[][] qualifiers,
                              java.lang.String tableName,
                              java.lang.String indexName,
                              boolean isConstraint,
                              boolean forUpdate,
                              int colRefItem,
                              int indexColItem,
                              int lockMode,
                              boolean tableLocked,
                              int isolationLevel,
                              int rowsPerRead,
                              boolean oneRowScan,
                              double optimizerEstimatedRowCount,
                              double optimizerEstimatedCost,
                              org.apache.derby.iapi.services.loader.GeneratedMethod closeCleanup)
                       throws org.apache.derby.iapi.error.StandardException
Constructor. Just save off the rowsPerRead argument and pass everything else down to TableScanResultSet

Method Detail

openScanController

protected void openScanController(org.apache.derby.iapi.store.access.TransactionController tc)
                           throws org.apache.derby.iapi.error.StandardException
Open the scan controller

Overrides:
openScanController in class TableScanResultSet

openCore

public void openCore()
              throws org.apache.derby.iapi.error.StandardException
Open up the result set. Delegate most work to TableScanResultSet.openCore(). Create a new array with rows for use in fetchNextGroup().

Specified by:
openCore in interface org.apache.derby.iapi.sql.execute.NoPutResultSet
Overrides:
openCore in class TableScanResultSet

reopenCore

public void reopenCore()
                throws org.apache.derby.iapi.error.StandardException
Reopen the result set. Delegate most work to TableScanResultSet.reopenCore(). Reuse the array of rows.

Specified by:
reopenCore in interface org.apache.derby.iapi.sql.execute.NoPutResultSet
Overrides:
reopenCore in class TableScanResultSet

getNextRowCore

public org.apache.derby.iapi.sql.execute.ExecRow getNextRowCore()
                                                         throws org.apache.derby.iapi.error.StandardException
Return the next row (if any) from the scan (if open). Reload the rowArray as necessary.

Specified by:
getNextRowCore in interface org.apache.derby.iapi.sql.execute.NoPutResultSet
Overrides:
getNextRowCore in class TableScanResultSet

reloadArray

private int reloadArray()
                 throws org.apache.derby.iapi.error.StandardException

close

public void close()
           throws org.apache.derby.iapi.error.StandardException
If the result set has been opened, close the open scan. Delegate most of the work to TableScanResultSet.

Specified by:
close in interface org.apache.derby.iapi.sql.ResultSet
Overrides:
close in class TableScanResultSet

canGetInstantaneousLocks

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

Overrides:
canGetInstantaneousLocks in class TableScanResultSet

requiresRelocking

public boolean requiresRelocking()
Description copied from interface: org.apache.derby.iapi.sql.execute.NoPutResultSet
Do we need to relock the row when going to the heap.

Specified by:
requiresRelocking in interface org.apache.derby.iapi.sql.execute.NoPutResultSet
Overrides:
requiresRelocking in class TableScanResultSet