class TemporaryRowHolderResultSet extends java.lang.Object implements CursorResultSet, NoPutResultSet, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
private RowLocation |
baseRowLocation |
private ExecRow |
currentRow |
private boolean |
currRowFromMem |
private boolean |
finished |
(package private) ConglomerateController |
heapCC |
private TemporaryRowHolderImpl |
holder |
(package private) DataValueDescriptor[] |
indexRow |
(package private) ScanController |
indexsc |
private boolean |
isAppendable |
private boolean |
isOpen |
private boolean |
isVirtualMemHeap |
private int |
numRowsOut |
private long |
positionIndexConglomId |
private ResultDescription |
resultDescription |
private ExecRow[] |
rowArray |
private ScanController |
scan |
private TransactionController |
tc |
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
Constructor and Description |
---|
TemporaryRowHolderResultSet(TransactionController tc,
ExecRow[] rowArray,
ResultDescription resultDescription,
boolean isVirtualMemHeap,
boolean isAppendable,
long positionIndexConglomId,
TemporaryRowHolderImpl holder)
Constructor
|
TemporaryRowHolderResultSet(TransactionController tc,
ExecRow[] rowArray,
ResultDescription resultDescription,
boolean isVirtualMemHeap,
TemporaryRowHolderImpl holder)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addWarning(java.sql.SQLWarning w)
Add a warning to this result set.
|
boolean |
checkRowPosition(int isType)
Determine if the cursor is before the first row in the result
set.
|
void |
cleanUp()
Tells the system to clean up on an error.
|
void |
clearCurrentRow()
Clear the current row
|
java.lang.Object |
clone()
Shallow clone this result set.
|
void |
close()
Clean up
|
void |
closeRowSource()
closeRowSource tells the RowSource that it will no longer need to
return any rows and it can release any resource it may have.
|
void |
deleteCurrentRow() |
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.
|
Activation |
getActivation()
Return the
Activation for this result set. |
ResultSet |
getAutoGeneratedKeysResultset()
ResultSet for rows inserted into the table (contains auto-generated keys columns only)
|
java.sql.Timestamp |
getBeginExecutionTimestamp()
Get the Timestamp for the beginning of execution.
|
ExecRow |
getCurrentRow()
This result set has its row from the last fetch done.
|
java.lang.String |
getCursorName()
Returns the name of the cursor, if this is cursor statement of some
type (declare, open, fetch, positioned update, positioned delete,
close).
|
java.sql.Timestamp |
getEndExecutionTimestamp()
Get the Timestamp for the end of execution.
|
double |
getEstimatedRowCount()
Get the estimated row count from this result set.
|
long |
getExecuteTime()
Get the execution time in milliseconds.
|
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.
|
static TemporaryRowHolderResultSet |
getNewRSOnCurrentRow(TriggerDescriptor triggerd,
Activation activation,
CursorResultSet rs,
int[] colsReadFromTable)
Whip up a new Temp ResultSet that has a single
row.
|
private ExecRow |
getNextAppendedRow() |
ExecRow |
getNextRow()
Returns the next row from the query, and returns NULL when there
are no more rows.
|
ExecRow |
getNextRowCore()
Get the next row.
|
DataValueDescriptor[] |
getNextRowFromRowSource()
Get the next row as an array of column objects.
|
int |
getPointOfAttachment()
Return the point of attachment for this subquery.
|
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.
|
ResultDescription |
getResultDescription()
Returns a ResultDescription object, which describes the results
of the statement this ResultSet is in.
|
RowLocation |
getRowLocation()
Returns the row location of the current base table row of the cursor.
|
int |
getRowNumber()
Returns the row number of the current row.
|
int |
getScanIsolationLevel()
Return the isolation level of the scan in the result set.
|
NoPutResultSet[] |
getSubqueryTrackingArray(int numSubqueries)
Get the subquery ResultSet tracking array from the top ResultSet.
|
long |
getTimeSpent(int type)
Return the total amount of time spent in this ResultSet
|
FormatableBitSet |
getValidColumns()
getValidColumns describes the DataValueDescriptor[] returned by all
calls to the getNextRowFromRowSource() call.
|
java.sql.SQLWarning |
getWarnings()
Return the set of warnings generated during the execution of
this result set.
|
boolean |
isClosed()
Find out if the ResultSet is closed or not.
|
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
|
private static int[] |
justTheRequiredColumnsPositions(int[] columnsArrary) |
void |
markAsTopResultSet()
Mark the ResultSet as the topmost one in the ResultSet tree.
|
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.
|
long |
modifiedRowCount()
Returns the number of rows affected by the statement.
|
boolean |
needsRowLocation()
needsRowLocation returns true iff this the row source expects the
drainer of the row source to call rowLocation after getting a row from
getNextRowFromRowSource.
|
boolean |
needsRowLocationForDeferredCheckConstraints() |
boolean |
needsToClone()
Does the caller of getNextRowFromRowSource() need to clone the row
in order to keep a reference to the row past the
getNextRowFromRowSource() call which returned the row.
|
void |
offendingRowLocation(RowLocation rl,
long containdId) |
void |
open()
Tells the system that there will be calls to getNextRow().
|
void |
openCore()
Open the scan and evaluate qualifiers and the like.
|
void |
positionScanAtRowLocation(RowLocation rl)
Positions the cursor in the specified rowLocation.
|
void |
reopenCore()
Reopen the scan.
|
boolean |
requiresRelocking()
Do we need to relock the row when going to the heap.
|
void |
reset(ExecRow[] rowArray)
Reset the exec row array and reinitialize
|
void |
reStartScan(long currentConglomId,
long pconglomId)
postion scan to start from after where we stopped earlier
|
int |
resultSetNumber()
Get the number of this ResultSet, which is guaranteed to be unique
within a statement.
|
boolean |
returnsRows()
Returns TRUE if the statement returns rows (i.e. is a SELECT
or FETCH statement), FALSE if it returns no rows.
|
void |
rowLocation(RowLocation rl)
rowLocation is a callback for the drainer of the row source to return
the rowLocation of the current row, i.e, the row that is being returned
by getNextRowFromRowSource.
|
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 |
setCurrentRow(ExecRow row)
Set the current row to the row passed in.
|
void |
setHasDeferrableChecks()
Set that we are acting on behalf of an insert result set that has
deferrable check constraints
|
void |
setNeedsRowLocation(boolean needsRowLocation)
Set whether or not the NPRS need the row location when acting
as a row source.
|
void |
setTargetResultSet(TargetResultSet trs)
Notify a NPRS that it is the source for the specified
TargetResultSet.
|
private void |
setupPositionBasedScan(long position) |
private static int[] |
shrinkArray(int[] columnsArrary) |
private static int[] |
supersetofAllColumns(int[] columnsArray1,
int[] columnsArray2) |
org.w3c.dom.Element |
toXML(org.w3c.dom.Element parentNode,
java.lang.String tag)
Produce an xml image of this ResultSet and its descendant ResultSets.
|
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.
|
private ExecRow[] rowArray
private int numRowsOut
private ScanController scan
private TransactionController tc
private boolean isOpen
private boolean finished
private ExecRow currentRow
private ResultDescription resultDescription
private boolean isAppendable
private long positionIndexConglomId
private boolean isVirtualMemHeap
private boolean currRowFromMem
private TemporaryRowHolderImpl holder
ConglomerateController heapCC
private RowLocation baseRowLocation
DataValueDescriptor[] indexRow
ScanController indexsc
public TemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, TemporaryRowHolderImpl holder)
tc
- the xact controllerrowArray
- the row arrayresultDescription
- value returned by getResultDescription()public TemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, boolean isAppendable, long positionIndexConglomId, TemporaryRowHolderImpl holder)
tc
- the xact controllerrowArray
- the row arrayresultDescription
- value returned by getResultDescription()isAppendable
- true,if we can insert rows after this result is createdpositionIndexConglomId
- conglomId of the index which has order rows
are inserted and their row locationpublic void reset(ExecRow[] rowArray)
rowArray
- the row arraypublic void reStartScan(long currentConglomId, long pconglomId) throws StandardException
StandardException
private static int[] supersetofAllColumns(int[] columnsArray1, int[] columnsArray2)
private static int[] shrinkArray(int[] columnsArrary)
private static int[] justTheRequiredColumnsPositions(int[] columnsArrary)
public static TemporaryRowHolderResultSet getNewRSOnCurrentRow(TriggerDescriptor triggerd, Activation activation, CursorResultSet rs, int[] colsReadFromTable) throws StandardException
triggerd
- We are building Temp resultset for this triggeractivation
- the activationrs
- the result setcolsReadFromTable
- The passed resultset is composed of
these columns. We will create a temp resultset which
will have either all these columns or only a subset of
these columns. It all depends on what columns are needed
by the trigger. If this param is null, then that means that
all the columns from the trigger table have been read into
the passed resultset.StandardException
- on errorpublic void markAsTopResultSet()
markAsTopResultSet
in interface NoPutResultSet
public void openCore() throws StandardException
openCore
in interface NoPutResultSet
StandardException
- thrown if cursor finished.public void reopenCore() throws StandardException
reopenCore
in interface NoPutResultSet
StandardException
- on errorpublic ExecRow getNextRowCore() throws StandardException
getNextRowCore
in interface NoPutResultSet
StandardException
- on errorpublic void deleteCurrentRow() throws StandardException
StandardException
private void setupPositionBasedScan(long position) throws StandardException
StandardException
private ExecRow getNextAppendedRow() throws StandardException
StandardException
public int getPointOfAttachment()
getPointOfAttachment
in interface NoPutResultSet
public int getScanIsolationLevel()
getScanIsolationLevel
in interface NoPutResultSet
public void setTargetResultSet(TargetResultSet trs)
setTargetResultSet
in interface NoPutResultSet
trs
- The TargetResultSet.public void setNeedsRowLocation(boolean needsRowLocation)
setNeedsRowLocation
in interface NoPutResultSet
public double getEstimatedRowCount()
getEstimatedRowCount
in interface NoPutResultSet
public int resultSetNumber()
resultSetNumber
in interface NoPutResultSet
public void setCurrentRow(ExecRow row)
setCurrentRow
in interface NoPutResultSet
row
- the new current rowpublic void clearCurrentRow()
clearCurrentRow
in interface ResultSet
public ExecRow getCurrentRow() throws StandardException
getCurrentRow
in interface CursorResultSet
StandardException
- thrown on failure.CursorResultSet
public RowLocation getRowLocation()
getRowLocation
in interface CursorResultSet
public void close() throws StandardException
close
in interface ResultSet
StandardException
- thrown on errorpublic boolean returnsRows()
returnsRows
in interface ResultSet
public long modifiedRowCount()
ResultSet
modifiedRowCount
in interface ResultSet
public ResultDescription getResultDescription()
getResultDescription
in interface ResultSet
public void open() throws StandardException
open
in interface ResultSet
StandardException
- Thrown on failurepublic ExecRow getAbsoluteRow(int row) throws StandardException
getAbsoluteRow
in interface ResultSet
row
- The position.StandardException
- Thrown on failureRow
public ExecRow getRelativeRow(int row) throws StandardException
getRelativeRow
in interface ResultSet
row
- The position.StandardException
- Thrown on failureRow
public ExecRow setBeforeFirstRow() throws StandardException
setBeforeFirstRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getFirstRow() throws StandardException
getFirstRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getNextRow() throws StandardException
getNextRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getPreviousRow() throws StandardException
getPreviousRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getLastRow() throws StandardException
getLastRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow setAfterLastRow() throws StandardException
setAfterLastRow
in interface ResultSet
StandardException
- Thrown on failureRow
public boolean checkRowPosition(int isType)
checkRowPosition
in interface ResultSet
public int getRowNumber()
getRowNumber
in interface ResultSet
public void cleanUp() throws StandardException
cleanUp
in interface ResultSet
StandardException
- Thrown on error.public boolean isClosed()
public void finish() throws StandardException
finish
in interface ResultSet
StandardException
- on errorpublic long getExecuteTime()
getExecuteTime
in interface ResultSet
public ResultSet getAutoGeneratedKeysResultset()
ResultSet
getAutoGeneratedKeysResultset
in interface ResultSet
ResultSet.getAutoGeneratedKeysResultset()
public java.sql.Timestamp getBeginExecutionTimestamp()
getBeginExecutionTimestamp
in interface ResultSet
public java.sql.Timestamp getEndExecutionTimestamp()
getEndExecutionTimestamp
in interface ResultSet
public 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 NoPutResultSet[] getSubqueryTrackingArray(int numSubqueries)
getSubqueryTrackingArray
in interface ResultSet
numSubqueries
- The size of the array (For allocation on demand.)public java.lang.String getCursorName()
getCursorName
in interface ResultSet
public boolean requiresRelocking()
NoPutResultSet
requiresRelocking
in interface NoPutResultSet
NoPutResultSet.requiresRelocking()
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
A null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.
If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.
If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().
getNextRowFromRowSource
in interface RowSource
StandardException
- Standard Derby Error Policypublic boolean needsToClone()
needsToClone
in interface RowSource
public FormatableBitSet getValidColumns()
getValidColumns
in interface RowSource
public void closeRowSource()
closeRowSource
in interface RowSource
public boolean needsRowLocation()
needsRowLocation
in interface RowLocationRetRowSource
rowLocation(org.apache.derby.iapi.types.RowLocation)
public void setHasDeferrableChecks()
NoPutResultSet
setHasDeferrableChecks
in interface NoPutResultSet
public boolean needsRowLocationForDeferredCheckConstraints()
needsRowLocationForDeferredCheckConstraints
in interface RowLocationRetRowSource
public void rowLocation(RowLocation rl) throws StandardException
boolean needsRL = rowSource.needsRowLocation(); DataValueDescriptor[] row; while((row = rowSource.getNextRowFromRowSource()) != null) { RowLocation rl = heapConglomerate.insertRow(row); if (needsRL) rowSource.rowLocation(rl); }
rowLocation
in interface RowLocationRetRowSource
StandardException
- on errorpublic void offendingRowLocation(RowLocation rl, long containdId) throws StandardException
offendingRowLocation
in interface RowLocationRetRowSource
StandardException
public void positionScanAtRowLocation(RowLocation rl) throws StandardException
NoPutResultSet
positionScanAtRowLocation
in interface NoPutResultSet
rl
- row location of the current cursor rowStandardException
- thrown on failure to
get location from storage engineThis method is result sets used for scroll insensitive updatable
result sets for other result set it is a no-op.
public boolean isForUpdate()
isForUpdate
in interface NoPutResultSet
public java.lang.Object clone()
clone
in class java.lang.Object
public void addWarning(java.sql.SQLWarning w)
ResultSet
addWarning
in interface ResultSet
w
- the warning to addpublic java.sql.SQLWarning getWarnings()
ResultSet
getWarnings
in interface ResultSet
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException
NoPutResultSet
updateRow
in interface NoPutResultSet
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.This method is result sets used for scroll insensitive updatable
result sets for other result set it is a no-op.
public void markRowAsDeleted() throws StandardException
NoPutResultSet
markRowAsDeleted
in interface NoPutResultSet
StandardException
- thrown on failure.This method is result sets used for scroll insensitive updatable
result sets for other result set it is a no-op.
public final Activation getActivation()
Activation
for this result set.getActivation
in interface ResultSet
public org.w3c.dom.Element toXML(org.w3c.dom.Element parentNode, java.lang.String tag) throws java.lang.Exception
ResultSet
Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.