Class TemporaryRowHolderResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.TemporaryRowHolderResultSet
-
- All Implemented Interfaces:
java.lang.Cloneable
,CursorResultSet
,NoPutResultSet
,ResultSet
,RowLocationRetRowSource
,RowSource
class TemporaryRowHolderResultSet extends java.lang.Object implements CursorResultSet, NoPutResultSet, java.lang.Cloneable
A result set to scan temporary row holders. Ultimately, this may be returned to users, hence the extra junk from the ResultSet interface.
-
-
Field Summary
Fields Modifier and Type Field 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
-
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
-
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
-
-
Constructor Summary
Constructors Constructor Description TemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, boolean isAppendable, long positionIndexConglomId, TemporaryRowHolderImpl holder)
ConstructorTemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, TemporaryRowHolderImpl holder)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 rowjava.lang.Object
clone()
Shallow clone this result set.void
close()
Clean upvoid
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 theActivation
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 ResultSetFormatableBitSet
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 trueprivate 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 reinitializevoid
reStartScan(long currentConglomId, long pconglomId)
postion scan to start from after where we stopped earlierint
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 constraintsvoid
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.
-
-
-
Field Detail
-
rowArray
private ExecRow[] rowArray
-
numRowsOut
private int numRowsOut
-
scan
private ScanController scan
-
tc
private TransactionController tc
-
isOpen
private boolean isOpen
-
finished
private boolean finished
-
currentRow
private ExecRow currentRow
-
resultDescription
private ResultDescription resultDescription
-
isAppendable
private boolean isAppendable
-
positionIndexConglomId
private long positionIndexConglomId
-
isVirtualMemHeap
private boolean isVirtualMemHeap
-
currRowFromMem
private boolean currRowFromMem
-
holder
private TemporaryRowHolderImpl holder
-
heapCC
ConglomerateController heapCC
-
baseRowLocation
private RowLocation baseRowLocation
-
indexRow
DataValueDescriptor[] indexRow
-
indexsc
ScanController indexsc
-
-
Constructor Detail
-
TemporaryRowHolderResultSet
public TemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, TemporaryRowHolderImpl holder)
Constructor- Parameters:
tc
- the xact controllerrowArray
- the row arrayresultDescription
- value returned by getResultDescription()
-
TemporaryRowHolderResultSet
public TemporaryRowHolderResultSet(TransactionController tc, ExecRow[] rowArray, ResultDescription resultDescription, boolean isVirtualMemHeap, boolean isAppendable, long positionIndexConglomId, TemporaryRowHolderImpl holder)
Constructor- Parameters:
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 location
-
-
Method Detail
-
reset
public void reset(ExecRow[] rowArray)
Reset the exec row array and reinitialize- Parameters:
rowArray
- the row array
-
reStartScan
public void reStartScan(long currentConglomId, long pconglomId) throws StandardException
postion scan to start from after where we stopped earlier- Throws:
StandardException
-
supersetofAllColumns
private static int[] supersetofAllColumns(int[] columnsArray1, int[] columnsArray2)
-
shrinkArray
private static int[] shrinkArray(int[] columnsArrary)
-
justTheRequiredColumnsPositions
private static int[] justTheRequiredColumnsPositions(int[] columnsArrary)
-
getNewRSOnCurrentRow
public static TemporaryRowHolderResultSet getNewRSOnCurrentRow(TriggerDescriptor triggerd, Activation activation, CursorResultSet rs, int[] colsReadFromTable) throws StandardException
Whip up a new Temp ResultSet that has a single row. This row will either have all the columns from the current row of the passed resultset or a subset of the columns from the passed resulset. It all depends on what columns are needed by the passed trigger and what columns exist in the resulset. The Temp resulset should only have the columns required by the trigger.- Parameters:
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.- Returns:
- a single row result set
- Throws:
StandardException
- on error
-
markAsTopResultSet
public void markAsTopResultSet()
Mark the ResultSet as the topmost one in the ResultSet tree. Useful for closing down the ResultSet on an error.- Specified by:
markAsTopResultSet
in interfaceNoPutResultSet
-
openCore
public void openCore() throws StandardException
Open the scan and evaluate qualifiers and the like. For us, there are no qualifiers, this is really a noop.- Specified by:
openCore
in interfaceNoPutResultSet
- Throws:
StandardException
- thrown if cursor finished.
-
reopenCore
public void reopenCore() throws StandardException
Reopen the scan. Typically faster than open()/close()- Specified by:
reopenCore
in interfaceNoPutResultSet
- Throws:
StandardException
- on error
-
getNextRowCore
public ExecRow getNextRowCore() throws StandardException
Get the next row.- Specified by:
getNextRowCore
in interfaceNoPutResultSet
- Returns:
- the next row, or null if none
- Throws:
StandardException
- on error
-
deleteCurrentRow
public void deleteCurrentRow() throws StandardException
- Throws:
StandardException
-
setupPositionBasedScan
private void setupPositionBasedScan(long position) throws StandardException
- Throws:
StandardException
-
getNextAppendedRow
private ExecRow getNextAppendedRow() throws StandardException
- Throws:
StandardException
-
getPointOfAttachment
public int getPointOfAttachment()
Return the point of attachment for this subquery. (Only meaningful for Any and Once ResultSets, which can and will only be at the top of a ResultSet for a subquery.)- Specified by:
getPointOfAttachment
in interfaceNoPutResultSet
- Returns:
- int Point of attachment (result set number) for this subquery. (-1 if not a subquery - also Sanity violation)
-
getScanIsolationLevel
public int getScanIsolationLevel()
Return the isolation level of the scan in the result set. Only expected to be called for those ResultSets that contain a scan.- Specified by:
getScanIsolationLevel
in interfaceNoPutResultSet
- Returns:
- The isolation level of the scan (in TransactionController constants).
-
setTargetResultSet
public void setTargetResultSet(TargetResultSet trs)
Notify a NPRS that it is the source for the specified TargetResultSet. This is useful when doing bulk insert.- Specified by:
setTargetResultSet
in interfaceNoPutResultSet
- Parameters:
trs
- The TargetResultSet.
-
setNeedsRowLocation
public void setNeedsRowLocation(boolean needsRowLocation)
Set whether or not the NPRS need the row location when acting as a row source. (The target result set determines this.)- Specified by:
setNeedsRowLocation
in interfaceNoPutResultSet
-
getEstimatedRowCount
public double getEstimatedRowCount()
Get the estimated row count from this result set.- Specified by:
getEstimatedRowCount
in interfaceNoPutResultSet
- Returns:
- The estimated row count (as a double) from this result set.
-
resultSetNumber
public int resultSetNumber()
Get the number of this ResultSet, which is guaranteed to be unique within a statement.- Specified by:
resultSetNumber
in interfaceNoPutResultSet
-
setCurrentRow
public void setCurrentRow(ExecRow row)
Set the current row to the row passed in.- Specified by:
setCurrentRow
in interfaceNoPutResultSet
- Parameters:
row
- the new current row
-
clearCurrentRow
public void clearCurrentRow()
Clear the current row- Specified by:
clearCurrentRow
in interfaceResultSet
-
getCurrentRow
public ExecRow getCurrentRow() throws StandardException
This result set has its row from the last fetch done. If the cursor is closed, a null is returned.- Specified by:
getCurrentRow
in interfaceCursorResultSet
- Returns:
- the last row returned;
- Throws:
StandardException
- thrown on failure.- See Also:
CursorResultSet
-
getRowLocation
public RowLocation getRowLocation()
Returns the row location of the current base table row of the cursor. If this cursor's row is composed of multiple base tables' rows, i.e. due to a join, then a null is returned. For a temporary row holder, we always return null.- Specified by:
getRowLocation
in interfaceCursorResultSet
- Returns:
- the row location of the current cursor row.
-
close
public void close() throws StandardException
Clean up- Specified by:
close
in interfaceResultSet
- Throws:
StandardException
- thrown on error
-
returnsRows
public boolean returnsRows()
Returns TRUE if the statement returns rows (i.e. is a SELECT or FETCH statement), FALSE if it returns no rows.- Specified by:
returnsRows
in interfaceResultSet
- Returns:
- TRUE if the statement returns rows, FALSE if not.
-
modifiedRowCount
public long modifiedRowCount()
Description copied from interface:ResultSet
Returns the number of rows affected by the statement. Only valid of returnsRows() returns false. For other DML statements, it returns the number of rows modified by the statement. For statements that do not affect rows (like DDL statements), it returns zero.- Specified by:
modifiedRowCount
in interfaceResultSet
- Returns:
- The number of rows affect by the statement, so far.
-
getResultDescription
public ResultDescription getResultDescription()
Returns a ResultDescription object, which describes the results of the statement this ResultSet is in. This will *not* be a description of this particular ResultSet, if this is not the outermost ResultSet.- Specified by:
getResultDescription
in interfaceResultSet
- Returns:
- A ResultDescription describing the results of the statement.
-
open
public void open() throws StandardException
Tells the system that there will be calls to getNextRow().- Specified by:
open
in interfaceResultSet
- Throws:
StandardException
- Thrown on failure
-
getAbsoluteRow
public ExecRow getAbsoluteRow(int row) throws StandardException
Returns the row at the absolute position from the query, and returns NULL when there is no such position. (Negative position means from the end of the result set.) Moving the cursor to an invalid position leaves the cursor positioned either before the first row (negative position) or after the last row (positive position). NOTE: An exception will be thrown on 0.- Specified by:
getAbsoluteRow
in interfaceResultSet
- Parameters:
row
- The position.- Returns:
- The row at the absolute position, or NULL if no such position.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
getRelativeRow
public ExecRow getRelativeRow(int row) throws StandardException
Returns the row at the relative position from the current cursor position, and returns NULL when there is no such position. (Negative position means toward the beginning of the result set.) Moving the cursor to an invalid position leaves the cursor positioned either before the first row (negative position) or after the last row (positive position). NOTE: 0 is valid. NOTE: An exception is thrown if the cursor is not currently positioned on a row.- Specified by:
getRelativeRow
in interfaceResultSet
- Parameters:
row
- The position.- Returns:
- The row at the relative position, or NULL if no such position.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
setBeforeFirstRow
public ExecRow setBeforeFirstRow() throws StandardException
Sets the current position to before the first row and returns NULL because there is no current row.- Specified by:
setBeforeFirstRow
in interfaceResultSet
- Returns:
- NULL.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
getFirstRow
public ExecRow getFirstRow() throws StandardException
Returns the first row from the query, and returns NULL when there are no rows.- Specified by:
getFirstRow
in interfaceResultSet
- Returns:
- The first row, or NULL if no rows.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
getNextRow
public ExecRow getNextRow() throws StandardException
Returns the next row from the query, and returns NULL when there are no more rows.- Specified by:
getNextRow
in interfaceResultSet
- Returns:
- The next row, or NULL if no more rows.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
getPreviousRow
public ExecRow getPreviousRow() throws StandardException
Returns the previous row from the query, and returns NULL when there are no more previous rows.- Specified by:
getPreviousRow
in interfaceResultSet
- Returns:
- The previous row, or NULL if no more previous rows.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
getLastRow
public ExecRow getLastRow() throws StandardException
Returns the last row from the query, and returns NULL when there are no rows.- Specified by:
getLastRow
in interfaceResultSet
- Returns:
- The last row, or NULL if no rows.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
setAfterLastRow
public ExecRow setAfterLastRow() throws StandardException
Sets the current position to after the last row and returns NULL because there is no current row.- Specified by:
setAfterLastRow
in interfaceResultSet
- Returns:
- NULL.
- Throws:
StandardException
- Thrown on failure- See Also:
Row
-
checkRowPosition
public boolean checkRowPosition(int isType)
Determine if the cursor is before the first row in the result set.- Specified by:
checkRowPosition
in interfaceResultSet
- Returns:
- true if before the first row, false otherwise. Returns false when the result set contains no rows.
-
getRowNumber
public int getRowNumber()
Returns the row number of the current row. Row numbers start from 1 and go to 'n'. Corresponds to row numbering used to position current row in the result set (as per JDBC).- Specified by:
getRowNumber
in interfaceResultSet
- Returns:
- the row number, or 0 if not on a row
-
cleanUp
public void cleanUp() throws StandardException
Tells the system to clean up on an error.- Specified by:
cleanUp
in interfaceResultSet
- Throws:
StandardException
- Thrown on error.
-
isClosed
public boolean isClosed()
Find out if the ResultSet is closed or not. Will report true for result sets that do not return rows.
-
finish
public void finish() throws StandardException
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(). Will close the result set if it is not already closed.- Specified by:
finish
in interfaceResultSet
- Throws:
StandardException
- on error
-
getExecuteTime
public long getExecuteTime()
Get the execution time in milliseconds.- Specified by:
getExecuteTime
in interfaceResultSet
- Returns:
- long The execution time in milliseconds.
-
getAutoGeneratedKeysResultset
public ResultSet getAutoGeneratedKeysResultset()
Description copied from interface:ResultSet
ResultSet for rows inserted into the table (contains auto-generated keys columns only)- Specified by:
getAutoGeneratedKeysResultset
in interfaceResultSet
- Returns:
- NoPutResultSet NoPutResultSets for rows inserted into the table.
- See Also:
ResultSet.getAutoGeneratedKeysResultset()
-
getBeginExecutionTimestamp
public java.sql.Timestamp getBeginExecutionTimestamp()
Get the Timestamp for the beginning of execution.- Specified by:
getBeginExecutionTimestamp
in interfaceResultSet
- Returns:
- Timestamp The Timestamp for the beginning of execution.
-
getEndExecutionTimestamp
public java.sql.Timestamp getEndExecutionTimestamp()
Get the Timestamp for the end of execution.- Specified by:
getEndExecutionTimestamp
in interfaceResultSet
- Returns:
- Timestamp The Timestamp for the end of execution.
-
getTimeSpent
public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpent
in interfaceResultSet
- Parameters:
type
- CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.- Returns:
- long The total amount of time spent (in milliseconds).
-
getSubqueryTrackingArray
public NoPutResultSet[] getSubqueryTrackingArray(int numSubqueries)
Get the subquery ResultSet tracking array from the top ResultSet. (Used for tracking open subqueries when closing down on an error.)- Specified by:
getSubqueryTrackingArray
in interfaceResultSet
- Parameters:
numSubqueries
- The size of the array (For allocation on demand.)- Returns:
- NoPutResultSet[] Array of NoPutResultSets for subqueries.
-
getCursorName
public 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).- Specified by:
getCursorName
in interfaceResultSet
- Returns:
- A String with the name of the cursor, if any. Returns NULL if this is not a cursor statement.
-
requiresRelocking
public boolean requiresRelocking()
Description copied from interface:NoPutResultSet
Do we need to relock the row when going to the heap.- Specified by:
requiresRelocking
in interfaceNoPutResultSet
- Returns:
- Whether or not we need to relock the row when going to the heap.
- See Also:
NoPutResultSet.requiresRelocking()
-
getNextRowFromRowSource
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
Get the next row as an array of column objects. The column objects can be a JBMS Storable or any Serializable/Externalizable/Formattable/Streaming type.
A return of null indicates that the complete set of rows has been read.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().
- Specified by:
getNextRowFromRowSource
in interfaceRowSource
- Throws:
StandardException
- Standard Derby Error Policy
-
needsToClone
public 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. This call must always return the same for all rows in a RowSource (ie. the caller will call this once per scan from a RowSource and assume the behavior is true for all rows in the RowSource).- Specified by:
needsToClone
in interfaceRowSource
-
getValidColumns
public FormatableBitSet getValidColumns()
getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call. If getValidColumns returns null, the number of columns is given by the DataValueDescriptor.length where DataValueDescriptor[] is returned by the preceeding getNextRowFromRowSource() call. Column N maps to DataValueDescriptor[N], where column numbers start at zero. If getValidColumns return a non null validColumns FormatableBitSet the number of columns is given by the number of bits set in validColumns. Column N is not in the partial row if validColumns.get(N) returns false. Column N is in the partial row if validColumns.get(N) returns true. If column N is in the partial row then it maps to DataValueDescriptor[M] where M is the count of calls to validColumns.get(i) that return true where i < N. If DataValueDescriptor.length is greater than the number of columns indicated by validColumns the extra entries are ignored.- Specified by:
getValidColumns
in interfaceRowSource
-
closeRowSource
public 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. Subsequent call to any method on the RowSource will result in undefined behavior. A closed rowSource can be closed again.- Specified by:
closeRowSource
in interfaceRowSource
-
needsRowLocation
public 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.- Specified by:
needsRowLocation
in interfaceRowLocationRetRowSource
- Returns:
- true iff this row source expects some row location to be returned
- See Also:
rowLocation(org.apache.derby.iapi.types.RowLocation)
-
setHasDeferrableChecks
public void setHasDeferrableChecks()
Description copied from interface:NoPutResultSet
Set that we are acting on behalf of an insert result set that has deferrable check constraints- Specified by:
setHasDeferrableChecks
in interfaceNoPutResultSet
-
needsRowLocationForDeferredCheckConstraints
public boolean needsRowLocationForDeferredCheckConstraints()
- Specified by:
needsRowLocationForDeferredCheckConstraints
in interfaceRowLocationRetRowSource
-
rowLocation
public void rowLocation(RowLocation rl) throws StandardException
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. This interface is for the purpose of loading a base table with index. In that case, the indices can be built at the same time the base table is laid down once the row location of the base row is known. This is an example pseudo code on how this call is expected to be used:boolean needsRL = rowSource.needsRowLocation(); DataValueDescriptor[] row; while((row = rowSource.getNextRowFromRowSource()) != null) { RowLocation rl = heapConglomerate.insertRow(row); if (needsRL) rowSource.rowLocation(rl); }
NeedsRowLocation and rowLocation will ONLY be called by a drainer of the row source which CAN return a row location. Drainer of row source which cannot return rowLocation will guarentee to not call either callbacks. Conversely, if NeedsRowLocation is called and it returns true, then for every row return by getNextRowFromRowSource, a rowLocation callback must also be issued with the row location of the row. Implementor of both the source and the drain of the row source must be aware of this protocol.
The RowLocation object is own by the caller of rowLocation, in other words, the drainer of the RowSource. This is so that we don't need to new a row location for every row. If the Row Source wants to keep the row location, it needs to clone it (RowLocation is a ClonableObject).- Specified by:
rowLocation
in interfaceRowLocationRetRowSource
- Throws:
StandardException
- on error
-
offendingRowLocation
public void offendingRowLocation(RowLocation rl, long containdId) throws StandardException
- Specified by:
offendingRowLocation
in interfaceRowLocationRetRowSource
- Throws:
StandardException
-
positionScanAtRowLocation
public void positionScanAtRowLocation(RowLocation rl) throws StandardException
Description copied from interface:NoPutResultSet
Positions the cursor in the specified rowLocation. Used for scrollable insensitive result sets in order to position the cursor back to a row that has already be visited.- Specified by:
positionScanAtRowLocation
in interfaceNoPutResultSet
- Parameters:
rl
- row location of the current cursor row- Throws:
StandardException
- thrown on failure to get location from storage engine- See Also:
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.
-
isForUpdate
public 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- Specified by:
isForUpdate
in interfaceNoPutResultSet
- Returns:
- Whether or not the result set is for update.
-
clone
public java.lang.Object clone()
Shallow clone this result set. Used in trigger reference. beetle 4373.- Overrides:
clone
in classjava.lang.Object
-
addWarning
public void addWarning(java.sql.SQLWarning w)
Description copied from interface:ResultSet
Add a warning to this result set.- Specified by:
addWarning
in interfaceResultSet
- Parameters:
w
- the warning to add
-
getWarnings
public java.sql.SQLWarning getWarnings()
Description copied from interface:ResultSet
Return the set of warnings generated during the execution of this result set. The warnings are cleared once this call returns.- Specified by:
getWarnings
in interfaceResultSet
-
updateRow
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException
Description copied from interface:NoPutResultSet
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.- Specified by:
updateRow
in interfaceNoPutResultSet
- Parameters:
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.- Throws:
StandardException
- thrown on failure.- See Also:
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.
-
markRowAsDeleted
public void markRowAsDeleted() throws StandardException
Description copied from interface:NoPutResultSet
Marks the resultSet's currentRow as deleted after a delete has been issued by either by using positioned delete or JDBC's deleteRow method.- Specified by:
markRowAsDeleted
in interfaceNoPutResultSet
- Throws:
StandardException
- thrown on failure.- See Also:
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.
-
getActivation
public final Activation getActivation()
Return theActivation
for this result set.- Specified by:
getActivation
in interfaceResultSet
- Returns:
- activation
-
toXML
public org.w3c.dom.Element toXML(org.w3c.dom.Element parentNode, java.lang.String tag) throws java.lang.Exception
Description copied from interface:ResultSet
Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.
-
-