org.apache.derby.impl.store.access.btree
Class BTreeMaxScan

java.lang.Object
  extended byorg.apache.derby.impl.store.access.btree.OpenBTree
      extended byorg.apache.derby.impl.store.access.btree.BTreeScan
          extended byorg.apache.derby.impl.store.access.btree.BTreeMaxScan
All Implemented Interfaces:
GenericScanController, GroupFetchScanController, RowCountable, ScanController, ScanManager
Direct Known Subclasses:
B2IMaxScan

public class BTreeMaxScan
extends BTreeScan

A BTreeScan implementation that provides the 90% solution to the max on btree problem. If the row is the last row in the btree it works very efficiently. This implementation will be removed once backward scan is fully functional.


Field Summary
 
Fields inherited from class org.apache.derby.impl.store.access.btree.BTreeScan
fetchNext_one_slot_array, init_fetchDesc, init_forUpdate, init_hold, init_lock_fetch_desc, init_qualifier, init_rawtran, init_scanColumnList, init_startKeyValue, init_startSearchOperator, init_stopKeyValue, init_stopSearchOperator, init_template, init_useUpdateLocks, lock_operation, SCAN_DONE, SCAN_HOLD_INIT, SCAN_HOLD_INPROGRESS, SCAN_INIT, SCAN_INPROGRESS, scan_position, scan_state, stat_numdeleted_rows_visited, stat_numpages_visited, stat_numrows_qualified, stat_numrows_visited
 
Fields inherited from class org.apache.derby.impl.store.access.btree.OpenBTree
btree_undo, container, err_containerid, init_lock_level, init_open_user_scans, runtime_mem
 
Fields inherited from interface org.apache.derby.iapi.store.access.ScanController
GE, GT, NA
 
Constructor Summary
BTreeMaxScan()
           
 
Method Summary
 boolean fetchMax(DataValueDescriptor[] fetch_row)
          Fetch the maximum row in the table.
private  boolean fetchMaxRowFromBeginning(BTreeRowPosition pos, DataValueDescriptor[] fetch_row)
          Fetch the maximum non-deleted row from the table.
protected  int fetchRows(BTreeRowPosition pos, DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers)
          disallow fetchRows on this scan type.
protected  void positionAtStartPosition(BTreeRowPosition pos)
          Position scan at "start" position of the scan.
 
Methods inherited from class org.apache.derby.impl.store.access.btree.BTreeScan
close, closeForEndTransaction, delete, didNotQualify, doesCurrentPositionQualify, fetch, fetchLocation, fetchNext, fetchNextGroup, fetchSet, getCurrentRecordHandleForDebugging, getScanInfo, init, isCurrentPositionDeleted, isKeyed, newRowLocationTemplate, next, positionAtDoneScan, positionAtDoneScanFromClose, positionAtNextPage, positionAtStartForBackwardScan, positionAtStartForForwardScan, process_qualifier, reopenScan, reopenScanByRowLocation, replace, reposition, savePosition, toString
 
Methods inherited from class org.apache.derby.impl.store.access.btree.OpenBTree
checkConsistency, debugConglomerate, getColumnSortOrderInfo, getConglomerate, getContainer, getContainerHandle, getEstimatedRowCount, getHeight, getHold, getLockingPolicy, getLockLevel, getOpenMode, getRawTran, getRuntimeMem, getSpaceInfo, getXactMgr, init, isClosed, isIndexableRowConsistent, isTableLocked, makeRecordHandle, reopen, setEstimatedRowCount, setLockingPolicy, test_errors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.store.access.GenericScanController
isTableLocked
 
Methods inherited from interface org.apache.derby.iapi.store.access.RowCountable
getEstimatedRowCount, setEstimatedRowCount
 

Constructor Detail

BTreeMaxScan

public BTreeMaxScan()
Method Detail

fetchMaxRowFromBeginning

private boolean fetchMaxRowFromBeginning(BTreeRowPosition pos,
                                         DataValueDescriptor[] fetch_row)
                                  throws StandardException
Fetch the maximum non-deleted row from the table.

Throws:
StandardException - Standard exception policy.

fetchRows

protected int fetchRows(BTreeRowPosition pos,
                        DataValueDescriptor[][] row_array,
                        RowLocation[] rowloc_array,
                        BackingStoreHashtable hash_table,
                        long max_rowcnt,
                        int[] key_column_numbers)
                 throws StandardException
disallow fetchRows on this scan type.

Specified by:
fetchRows in class BTreeScan
Throws:
StandardException - Standard exception policy.

positionAtStartPosition

protected void positionAtStartPosition(BTreeRowPosition pos)
                                throws StandardException
Position scan at "start" position of the scan.

Positions the scan to the slot just after the first record to be returned from the backward scan. Returns the start page latched, and sets "current_slot" to the slot number just right of the first slot to return.

Specified by:
positionAtStartPosition in class BTreeScan
Returns:
The leaf page containing the start position, or null if no start position is found.
Throws:
StandardException - Standard exception policy.

fetchMax

public boolean fetchMax(DataValueDescriptor[] fetch_row)
                 throws StandardException
Fetch the maximum row in the table.

Utility routine used by both fetchSet() and fetchNextGroup().

Throws:
StandardException - Standard exception policy.


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.