|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.access.conglomerate.GenericController
org.apache.derby.impl.store.access.conglomerate.GenericScanController
org.apache.derby.impl.store.access.heap.HeapScan
org.apache.derby.impl.store.access.heap.HeapCompressScan
Field Summary | |
private long |
pagenum_to_start_moving_rows
Fields of HeapScan |
Fields inherited from class org.apache.derby.impl.store.access.conglomerate.GenericScanController |
SCAN_DONE, SCAN_HOLD_INIT, SCAN_HOLD_INPROGRESS, SCAN_INIT, SCAN_INPROGRESS, scan_position, stat_numpages_visited, stat_numrows_qualified, stat_numrows_visited |
Fields inherited from class org.apache.derby.impl.store.access.conglomerate.GenericController |
open_conglom |
Fields inherited from interface org.apache.derby.iapi.store.access.ScanController |
GE, GT, NA |
Constructor Summary | |
HeapCompressScan()
The only constructor for a HeapCompressScan returns a scan in the closed state, the caller must call open. |
Method Summary | |
void |
fetchLocation(RowLocation templateLocation)
Fetch the location of the current position in the scan. |
boolean |
fetchNext(DataValueDescriptor[] fetch_row)
Fetch the row at the next position of the Scan. |
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] rowloc_array)
Fetch the next N rows from the table. |
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] old_rowloc_array,
RowLocation[] new_rowloc_array)
Protected override implementation of routines in GenericController class: |
private int |
fetchRowsForCompress(DataValueDescriptor[][] row_array,
RowLocation[] oldrowloc_array,
RowLocation[] newrowloc_array)
Fetch the next N rows from the table. |
ScanInfo |
getScanInfo()
Return ScanInfo object which describes performance of scan. |
boolean |
next()
Move to the next position in the scan. |
private void |
positionAfterThisPage(RowPosition pos)
Set scan position to just after current page. |
protected void |
positionAtResumeScan(RowPosition pos)
Reposition the scan upon entering the fetchRows loop. |
protected void |
positionAtStartForForwardScan(RowPosition pos)
Move the scan from SCAN_INIT to SCAN_INPROGRESS. |
protected void |
queueDeletePostCommitWork(RowPosition pos)
Protected concrete impl of abstract methods of GenericController class: |
void |
reopenScanByRowLocation(RowLocation startRowLocation,
Qualifier[][] qualifier)
Reposition the current scan. |
void |
savePosition(Conglomerate conglom,
Page page)
Do work necessary to maintain the current position in the scan. |
protected void |
setRowLocationArray(RowLocation[] rowloc_array,
int index,
RecordHandle rh)
|
protected void |
setRowLocationArray(RowLocation[] rowloc_array,
int index,
RowPosition pos)
Private/Protected methods of This class: |
Methods inherited from class org.apache.derby.impl.store.access.conglomerate.GenericScanController |
allocateScanPosition, close, closeForEndTransaction, delete, didNotQualify, doesCurrentPositionQualify, fetch, fetchRows, fetchSet, getNumPagesVisited, getNumRowsQualified, getNumRowsVisited, getQualifier, getScanColumnList, getScanPosition, getScanState, getStartKeyValue, getStartSearchOperator, getStopKeyValue, getStopSearchOperator, init, isCurrentPositionDeleted, positionAtDoneScan, positionAtInitScan, positionAtNextPage, reopenScan, reopenScanByRecordHandle, replace, setScanPosition, setScanState |
Methods inherited from class org.apache.derby.impl.store.access.conglomerate.GenericController |
checkConsistency, debugConglomerate, getEstimatedRowCount, getInternalTablePropertySet, getOpenConglom, getRowPositionFromRowLocation, getSpaceInfo, getTableProperties, init, isKeyed, isTableLocked, newRowLocationTemplate, setEstimatedRowCount |
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.store.access.conglomerate.ScanManager |
closeForEndTransaction, fetchSet |
Methods inherited from interface org.apache.derby.iapi.store.access.ScanController |
delete, didNotQualify, doesCurrentPositionQualify, fetch, isCurrentPositionDeleted, replace |
Methods inherited from interface org.apache.derby.iapi.store.access.GenericScanController |
close, isKeyed, isTableLocked, newRowLocationTemplate, reopenScan |
Methods inherited from interface org.apache.derby.iapi.store.access.RowCountable |
getEstimatedRowCount, setEstimatedRowCount |
Field Detail |
private long pagenum_to_start_moving_rows
Constructor Detail |
public HeapCompressScan()
Method Detail |
public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] old_rowloc_array, RowLocation[] new_rowloc_array) throws StandardException
fetchNextGroup
in interface GroupFetchScanController
fetchNextGroup
in class HeapScan
StandardException
private int fetchRowsForCompress(DataValueDescriptor[][] row_array, RowLocation[] oldrowloc_array, RowLocation[] newrowloc_array) throws StandardException
Utility routine used by both fetchSet() and fetchNextGroup().
StandardException
- Standard exception policy.protected void positionAtResumeScan(RowPosition pos) throws StandardException
Called upon entering fetchRows() while in the SCAN_INPROGRESS state. Do work necessary to look at rows in the current page of the scan.
The default implementation uses a record handle to maintain a scan position. It will get the latch again on the current scan position and set the slot to the current record handle.
positionAtResumeScan
in class GenericScanController
StandardException
- Standard exception policy.protected void positionAtStartForForwardScan(RowPosition pos) throws StandardException
This routine is called to move the scan from SCAN_INIT to SCAN_INPROGRESS. Upon return from this routine it is expected that scan_position is set such that calling the generic scan loop will reach the first row of the scan. Note that this usually means setting the scan_postion to one before the 1st row to be returned.
positionAtStartForForwardScan
in class GenericScanController
StandardException
- Standard exception policy.private void positionAfterThisPage(RowPosition pos) throws StandardException
Used to set the position of the scan if a record handle is not avaliable. In this case current_rh will be set to null, and current_pageno will be set to the current page number. On resume of the scan, the scan will be set to just before the first row returned form a getNextPage(current_pageno) call.
A positionAtResumeScan(scan_position) is necessary to continue the scan after this call.
StandardException
- Standard exception policy.protected void queueDeletePostCommitWork(RowPosition pos) throws StandardException
queueDeletePostCommitWork
in class GenericController
StandardException
protected void setRowLocationArray(RowLocation[] rowloc_array, int index, RowPosition pos) throws StandardException
setRowLocationArray
in class GenericScanController
StandardException
protected void setRowLocationArray(RowLocation[] rowloc_array, int index, RecordHandle rh) throws StandardException
StandardException
public boolean fetchNext(DataValueDescriptor[] fetch_row) throws StandardException
fetchNext
in interface ScanController
fetch_row
- The template row into which the value
of the next position in the scan is to be stored.
StandardException
- Standard exception policy.ScanController.fetch(org.apache.derby.iapi.types.DataValueDescriptor[])
,
RowUtil
public boolean next() throws StandardException
ScanController
next
in interface ScanController
StandardException
- Standard exception policy.ScanController.next()
public void fetchLocation(RowLocation templateLocation) throws StandardException
ScanController
fetchLocation
in interface ScanController
fetchLocation
in class GenericScanController
StandardException
- Standard exception policy.ScanController.fetchLocation(org.apache.derby.iapi.types.RowLocation)
public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array) throws StandardException
GroupFetchScanController
The client allocates an array of N rows and passes it into the fetchNextSet() call. The client must at least allocate a row and set row_array[0] to this row. The client can optionally either leave the rest of array entries null, or allocate rows to the slots. If access finds an entry to be null, and wants to read a row into it, it will allocate a row to the slot. Once fetchNextGroup() returns "ownership" of the row passes back to the client, access will not keep references to the allocated row. Expected usage is that the client will specify an array of some number (say 10), and then only allocate a single row. This way if only 1 row qualifies only one row will have been allocated.
This routine does the equivalent of N fetchNext() calls, filling in each of the rows in the array. Locking is performed exactly as if the N fetchNext() calls had been made.
It is up to Access how many rows to return. fetchNextGroup() will return how many rows were filled in. If fetchNextGroup() returns 0 then the scan is complete, (ie. the scan is in the same state as if fetchNext() had returned false). If the scan is not complete then fetchNext() will return (1 <= row_count <= N).
The current position of the scan is undefined if fetchNextSet() is used (ie. mixing fetch()/fetchNext() and fetchNextSet() calls in a single scan does not work). This is because a fetchNextSet() request for 5 rows from a heap where the first 2 rows qualify, but no other rows qualify will result in the scan being positioned at the end of the table, while if 5 rows did qualify the scan will be positioned on the 5th row.
If the row loc array is non-null then for each row fetched into the row array, a corresponding fetchLocation() call will be made to fill in the rowloc_array. This array, like the row array can be initialized with only one non-null RowLocation and access will allocate the rest on demand.
Qualifiers, start and stop positioning of the openscan are applied just as in a normal scan.
The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description.
Expected usage: // allocate an array of 5 empty rows DataValueDescriptor[][] row_array = allocate_row_array(5); int row_cnt = 0; scan = openScan(); while ((row_cnt = scan.fetchNextSet(row_array, null) != 0) { // I got "row_cnt" rows from the scan. These rows will be // found in row_array[0] through row_array[row_cnt - 1] }
fetchNextGroup
in interface GroupFetchScanController
row_array
- The array of rows to copy rows into.
row_array[].length must >= 1. The first entry
must be non-null destination rows, other entries
may be null and will be allocated by access
if needed.rowloc_array
- If non-null, the array of row locations to
copy into. If null, no row locations are
retrieved.
StandardException
- Standard exception policy.public ScanInfo getScanInfo() throws StandardException
Return ScanInfo object which contains information about the current scan.
getScanInfo
in interface GenericScanController
getScanInfo
in class GenericScanController
StandardException
- Standard exception policy.ScanInfo
public void reopenScanByRowLocation(RowLocation startRowLocation, Qualifier[][] qualifier) throws StandardException
The statistics gathered by the scan are not reset to 0 by a reopenScan(), rather they continue to accumulate.
Note that this operation is currently only supported on Heap conglomerates. Also note that order of rows within are heap are not guaranteed, so for instance positioning at a RowLocation in the "middle" of a heap, then inserting more data, then continuing the scan is not guaranteed to see the new rows - they may be put in the "beginning" of the heap.
reopenScanByRowLocation
in interface GenericScanController
reopenScanByRowLocation
in class GenericScanController
startRowLocation
- An existing RowLocation within the conglomerate,
at which to position the start of the scan. The scan will begin at this
location and continue forward until the end of the conglomerate.
Positioning at a non-existent RowLocation (ie. an invalid one or one that
had been deleted), will result in an exception being thrown when the
first next operation is attempted.qualifier
- An array of qualifiers which, applied
to each key, restrict the rows returned by the scan. Rows
for which any one of the qualifiers returns false are not
returned by the scan. If null, all rows are returned.
StandardException
- Standard exception policy.public void savePosition(Conglomerate conglom, Page page) throws StandardException
The latched page in the conglomerate "congomid" is changing, do whatever is necessary to maintain the current position of the scan. For some conglomerates this may be a no-op.
savePosition
in interface ScanManager
conglom
- Conglomerate being changed.page
- Page in the conglomerate being changed.
StandardException
- Standard exception policy.
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |