public class ScrollInsensitiveResultSet extends NoPutResultSetImpl implements CursorResultSet
+-------------------------------+ | KEY | +-------------------------------+ | Row | +-------------------------------+where key is the position of the row in the result set and row is the data. And for updatable result sets it will contain:
+-------------------------------+ | KEY | [0] +-------------------------------+ | RowLocation | [POS_ROWLOCATION] +-------------------------------+ | Deleted | [POS_ROWDELETED] +-------------------------------+ | Updated | [POS_ROWUPDATED] +-------------------------------+ | Row | [extraColumns ... n] +-------------------------------+where key is the position of the row in the result set, rowLocation is the row location of that row in the Heap, Deleted indicates whether the row has been deleted, Updated indicates whether the row has been updated, and row is the data.
BasicNoPutResultSetImpl.FieldComparator
Modifier and Type | Field and Description |
---|---|
private boolean |
afterLast |
private boolean |
beforeFirst |
private int |
currentPosition |
private int |
extraColumns |
private BackingStoreHashtable |
ht |
private boolean |
keepAfterCommit |
private static int |
LAST_EXTRA_COLUMN |
private int |
lastPosition |
private long |
maxRows |
private boolean |
needsRepositioning |
int |
numFromHashTable |
int |
numToHashTable |
private static int |
POS_ROWDELETED |
private static int |
POS_ROWLOCATION |
private static int |
POS_ROWUPDATED |
private SQLInteger |
positionInHashTable |
private int |
positionInSource |
private ExecRow |
resultRow |
private boolean |
seenFirst |
private boolean |
seenLast |
NoPutResultSet |
source |
private int |
sourceRowWidth |
private CursorResultSet |
target |
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSet
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
Constructor and Description |
---|
ScrollInsensitiveResultSet(NoPutResultSet source,
Activation activation,
int resultSetNumber,
int sourceRowWidth,
double optimizerEstimatedRowCount,
double optimizerEstimatedCost)
Constructor for a ScrollInsensitiveResultSet
|
Modifier and Type | Method and Description |
---|---|
private void |
addRowToHashTable(ExecRow sourceRow,
int position,
RowLocation rowLoc,
boolean rowUpdated)
Add a row to the backing hash table, keyed on position.
|
boolean |
checkRowPosition(int isType)
Determine if the cursor is before the first row in the result
set.
|
void |
close()
If the result set has been opened,
close the open scan.
|
void |
finish()
Tells the system that there will be no more access
to any database information via this result set;
in particular, no more calls to open().
|
ExecRow |
getAbsoluteRow(int row)
Returns the row at the absolute position from the query,
and returns NULL when there is no such position.
|
ExecRow |
getCurrentRow()
Gets information from last getNextRow call.
|
private DataValueDescriptor[] |
getCurrentRowFromHashtable()
Get the column array from the current position in the hash table
|
ExecRow |
getFirstRow()
Returns the first row from the query, and returns NULL when there
are no rows.
|
ExecRow |
getLastRow()
Returns the last row from the query, and returns NULL when there
are no rows.
|
ExecRow |
getNextRowCore()
Return the requested values computed
from the next row (if any) for which
the restriction evaluates to true.
|
private ExecRow |
getNextRowFromSource() |
ExecRow |
getPreviousRow()
Returns the previous row from the query, and returns NULL when there
are no more previous rows.
|
ExecRow |
getRelativeRow(int row)
Returns the row at the relative position from the current
cursor position, and returns NULL when there is no such position.
|
private DataValueDescriptor[] |
getRowArrayFromHashTable(int position)
Get the row data at the specified position
from the hash table.
|
private ExecRow |
getRowFromHashTable(int position)
Get the row at the specified position
from the hash table.
|
RowLocation |
getRowLocation()
Gets information from its source.
|
int |
getRowNumber()
Returns the row number of the current row.
|
long |
getTimeSpent(int type)
Return the total amount of time spent in this ResultSet
|
boolean |
isDeleted()
Returns TRUE if the row was been deleted within the transaction,
otherwise returns FALSE
|
boolean |
isForUpdate()
Is this ResultSet or it's source result set for update
This method will be overriden in the inherited Classes
if it is true
|
boolean |
isUpdated()
Returns TRUE if the row was been updated within the transaction,
otherwise returns FALSE
|
void |
markRowAsDeleted()
Marks the resultSet's currentRow as deleted after a delete has been
issued by either by using positioned delete or JDBC's deleteRow
method.
|
void |
openCore()
open a scan on the source. scan parameters are evaluated
at each open, so there is probably some way of altering
their values...
|
private void |
positionInLastFetchedRow()
Positions the cursor in the last fetched row.
|
void |
reopenCore()
reopen a scan on the table. scan parameters are evaluated
at each open, so there is probably some way of altering
their values...
|
ExecRow |
setAfterLastRow()
Sets the current position to after the last row and returns NULL
because there is no current row.
|
ExecRow |
setBeforeFirstRow()
Sets the current position to before the first row and returns NULL
because there is no current row.
|
void |
updateRow(ExecRow row,
RowChanger rowChanger)
Updates the resultSet's current row with it's new values after
an update has been issued either using positioned update or
JDBC's udpateRow method.
|
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue
addWarning, attachStatementContext, checkCancellationFlag, childrenToXML, cleanUp, dumpTimeStats, finishAndRTS, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getLanguageConnectionContext, getNextRow, getPointOfAttachment, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, requiresRelocking, returnsRows, setCompactRow, setCompatRow, toXML, toXML
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addWarning, cleanUp, clearCurrentRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getNextRow, getResultDescription, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, toXML
public NoPutResultSet source
private int sourceRowWidth
private BackingStoreHashtable ht
private ExecRow resultRow
private int positionInSource
private int currentPosition
private int lastPosition
private boolean seenFirst
private boolean seenLast
private boolean beforeFirst
private boolean afterLast
public int numFromHashTable
public int numToHashTable
private long maxRows
private boolean keepAfterCommit
private int extraColumns
private SQLInteger positionInHashTable
private CursorResultSet target
private boolean needsRepositioning
private static final int POS_ROWLOCATION
private static final int POS_ROWDELETED
private static final int POS_ROWUPDATED
private static final int LAST_EXTRA_COLUMN
public ScrollInsensitiveResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, int sourceRowWidth, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException
source
- The NoPutResultSet from which to get rows
to scroll throughactivation
- The activation for this executionresultSetNumber
- The resultSetNumbersourceRowWidth
- # of columns in the source rowStandardException
- on errorpublic void openCore() throws StandardException
openCore
in interface NoPutResultSet
StandardException
- thrown on failurepublic void reopenCore() throws StandardException
reopenCore
in interface NoPutResultSet
reopenCore
in class BasicNoPutResultSetImpl
StandardException
- thrown if cursor finished.NoPutResultSet.openCore()
public ExecRow getAbsoluteRow(int row) throws StandardException
getAbsoluteRow
in interface ResultSet
getAbsoluteRow
in class BasicNoPutResultSetImpl
row
- The position.StandardException
- Thrown on failureRow
public ExecRow getRelativeRow(int row) throws StandardException
getRelativeRow
in interface ResultSet
getRelativeRow
in class BasicNoPutResultSetImpl
row
- The position.StandardException
- Thrown on failureRow
public ExecRow setBeforeFirstRow()
setBeforeFirstRow
in interface ResultSet
setBeforeFirstRow
in class BasicNoPutResultSetImpl
Row
public ExecRow getFirstRow() throws StandardException
getFirstRow
in interface ResultSet
getFirstRow
in class BasicNoPutResultSetImpl
StandardException
- Thrown on failureRow
public ExecRow getNextRowCore() throws StandardException
NoPutResultSet
restriction and projection parameters are evaluated for each row.
getNextRowCore
in interface NoPutResultSet
getNextRowCore
in class BasicNoPutResultSetImpl
StandardException
- thrown on failureNoPutResultSet.getNextRowCore()
public ExecRow getPreviousRow() throws StandardException
getPreviousRow
in interface ResultSet
getPreviousRow
in class BasicNoPutResultSetImpl
StandardException
- Thrown on failureRow
public ExecRow getLastRow() throws StandardException
getLastRow
in interface ResultSet
getLastRow
in class BasicNoPutResultSetImpl
StandardException
- Thrown on failureRow
public ExecRow setAfterLastRow() throws StandardException
setAfterLastRow
in interface ResultSet
setAfterLastRow
in class BasicNoPutResultSetImpl
StandardException
- Thrown on failureRow
public boolean checkRowPosition(int isType) throws StandardException
checkRowPosition
in interface ResultSet
checkRowPosition
in class BasicNoPutResultSetImpl
StandardException
- Thrown on error.public int getRowNumber()
getRowNumber
in interface ResultSet
getRowNumber
in class BasicNoPutResultSetImpl
private ExecRow getNextRowFromSource() throws StandardException
StandardException
public void close() throws StandardException
close
in interface ResultSet
close
in class NoPutResultSetImpl
StandardException
- thrown on errorpublic void finish() throws StandardException
ResultSet
finish
in interface ResultSet
finish
in class BasicNoPutResultSetImpl
StandardException
- on errorpublic long getTimeSpent(int type)
getTimeSpent
in interface ResultSet
type
- CURRENT_RESULTSET_ONLY - time spent only in this ResultSet
ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.public RowLocation getRowLocation() throws StandardException
getRowLocation
in interface CursorResultSet
StandardException
- thrown on failureCursorResultSet
public ExecRow getCurrentRow() throws StandardException
getCurrentRow
in interface CursorResultSet
StandardException
- thrown on failure.CursorResultSet
private void addRowToHashTable(ExecRow sourceRow, int position, RowLocation rowLoc, boolean rowUpdated) throws StandardException
sourceRow
- The row to add.position
- The keyrowLoc
- The rowLocation of the row to add.rowUpdated
- Indicates whether the row has been updated.StandardException
private ExecRow getRowFromHashTable(int position) throws StandardException
position
- The specified position.StandardException
- thrown on failureprivate DataValueDescriptor[] getRowArrayFromHashTable(int position) throws StandardException
position
- The specified position.StandardException
- thrown on failureprivate void positionInLastFetchedRow() throws StandardException
StandardException
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException
NoPutResultSet
updateRow
in interface NoPutResultSet
updateRow
in class NoPutResultSetImpl
row
- new values for the currentRowrowChanger
- holds information about row: what columns of it is to
be used for updating, and what underlying base table column each
such column corresponds to.StandardException
- thrown on failure.Sets the updated column of the hash table to true and updates the row
in the hash table with the new values for the row.
public void markRowAsDeleted() throws StandardException
NoPutResultSet
markRowAsDeleted
in interface NoPutResultSet
markRowAsDeleted
in class NoPutResultSetImpl
StandardException
- thrown on failure.Sets the deleted column of the hash table to true in the current row.
public boolean isDeleted() throws StandardException
StandardException
- on errorpublic boolean isUpdated() throws StandardException
StandardException
- on errorpublic boolean isForUpdate()
NoPutResultSetImpl
isForUpdate
in interface NoPutResultSet
isForUpdate
in class NoPutResultSetImpl
private DataValueDescriptor[] getCurrentRowFromHashtable() throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.