Class DependentResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.ScanResultSet
org.apache.derby.impl.sql.execute.DependentResultSet
- All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
DependentResultSet should be used by only ON DELETE CASCADE/ON DELETE SET NULL ref
actions implementation to gather the rows from the dependent tables.
Idea is to scan the foreign key index for the rows in
the source table materialized temporary result set.
Scanning of foreign key index gives us the
rows that needs to be deleted on dependent tables. Using the row location
we got from the index , base row is fetched.
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescription(package private) RowLocationbooleanprotected longprotected boolean(package private) int[]boolean(package private) ConglomerateControllerprotected DynamicCompiledOpenConglomInfoprotected StaticCompiledOpenConglomInfo(package private) DynamicCompiledOpenConglomInfo(package private) IndexRow(package private) ExecRow(package private) ScanController(package private) StaticCompiledOpenConglomInfobooleanprotected boolean(package private) boolean(package private) intboolean(package private) Stringprotected Qualifier[][](package private) RowLocationintprotected longprotected boolean(package private) intprotected ScanControllerprotected booleanprivate Properties(package private) ExecRow(package private) TemporaryRowHolderResultSet(package private) int[](package private) TemporaryRowHolderResultSet[](package private) TemporaryRowHolder[]protected ExecIndexRowprotected intprotected ExecIndexRowprotected int(package private) Vector<TemporaryRowHolder> (package private) TransactionControllerFields inherited from class ScanResultSet
accessedCols, candidate, fetchRowLocations, indexName, isolationLevel, lockMode, resultRowBuilder, tableNameFields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSetFields inherited from class BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArrayFields inherited from interface NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBERFields inherited from interface ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST -
Constructor Summary
ConstructorsConstructorDescriptionDependentResultSet(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int lockMode, boolean tableLocked, int isolationLevel, int rowsPerRead, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost, String parentResultSetId, long fkIndexConglomId, int fkColArrayItem, int rltItem) -
Method Summary
Modifier and TypeMethodDescriptionprivate void(package private) booleanCan we get instantaneous locks when getting share row locks at READ COMMITTED.voidclose()Close the all the opens we did in this result set.private ExecRowFetch the base row corresponding to the current index rowprivate ExecRowFetch a row from the index scan.voidfinish()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().Returns the current row of the result set.private ExecRowReturn the requested values computed from the next row (if any) for which the restriction evaluates to true.Returns the row location of the current base table row of the cursor.longgetTimeSpent(int type) Return the total amount of time spent in this ResultSetvoidopenCore()open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...private voidopenIndexScan(ExecRow searchRow) private ScanControlleropenIndexScanController(ExecRow searchRow) Get a scan controller positioned using searchRow as the start/stop position.private StringprintPosition(int searchOperator, ExecIndexRow positioner) Return a start or stop positioner as a String.Return an array of Qualifiers as a Stringprivate voidreopenIndexScanController(ExecRow searchRow) private voidsetupQualifierRow(ExecRow searchRow) Methods inherited from class ScanResultSet
getScanIsolationLevel, initIsolationLevel, setRowLocationsState, toXMLMethods inherited from class NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRowMethods inherited from class BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXMLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResultSet
addWarning, checkRowPosition, cleanUp, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
Field Details
-
heapCC
ConglomerateController heapCC -
baseRowLocation
RowLocation baseRowLocation -
indexRow
ExecRow indexRow -
indexQualifierRow
IndexRow indexQualifierRow -
indexSC
ScanController indexSC -
indexScoci
StaticCompiledOpenConglomInfo indexScoci -
indexDcoci
DynamicCompiledOpenConglomInfo indexDcoci -
numFkColumns
int numFkColumns -
isOpen
boolean isOpen -
source
TemporaryRowHolderResultSet source -
tc
-
parentResultSetId
String parentResultSetId -
fkColArray
int[] fkColArray -
rowLocation
RowLocation rowLocation -
sourceRowHolders
TemporaryRowHolder[] sourceRowHolders -
sourceResultSets
TemporaryRowHolderResultSet[] sourceResultSets -
sourceOpened
int[] sourceOpened -
sArrayIndex
int sArrayIndex -
sVector
Vector<TemporaryRowHolder> sVector -
scanController
-
scanControllerOpened
protected boolean scanControllerOpened -
isKeyed
protected boolean isKeyed -
firstScan
protected boolean firstScan -
startPosition
-
stopPosition
-
conglomId
protected long conglomId -
heapDcoci
-
heapScoci
-
startSearchOperator
protected int startSearchOperator -
stopSearchOperator
protected int stopSearchOperator -
qualifiers
-
userSuppliedOptimizerOverrides
-
runTimeStatisticsOn
protected boolean runTimeStatisticsOn -
rowsPerRead
public int rowsPerRead -
forUpdate
public boolean forUpdate -
scanProperties
-
startPositionString
-
stopPositionString
-
isConstraint
public boolean isConstraint -
coarserLock
public boolean coarserLock -
oneRowScan
public boolean oneRowScan -
rowsThisScan
protected long rowsThisScan -
searchRow
ExecRow searchRow
-
-
Constructor Details
-
DependentResultSet
DependentResultSet(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int lockMode, boolean tableLocked, int isolationLevel, int rowsPerRead, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost, String parentResultSetId, long fkIndexConglomId, int fkColArrayItem, int rltItem) throws StandardException - Throws:
StandardException
-
-
Method Details
-
openIndexScanController
Get a scan controller positioned using searchRow as the start/stop position. The assumption is that searchRow is of the same format as the index being opened.- Parameters:
searchRow- the row to match- Throws:
StandardException- on error
-
reopenIndexScanController
- Throws:
StandardException
-
setupQualifierRow
-
openIndexScan
- Throws:
StandardException
-
fetchIndexRow
Fetch a row from the index scan.- Returns:
- The row or null. Note that the next call to fetch will replace the columns in the returned row.
- Throws:
StandardException- Ooops
-
fetchBaseRow
Fetch the base row corresponding to the current index row- Returns:
- The base row row or null.
- Throws:
StandardException- Ooops
-
getNextRowCore
Description copied from interface:NoPutResultSetReturn the requested values computed from the next row (if any) for which the restriction evaluates to true.restriction and projection parameters are evaluated for each row.
- Specified by:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein classBasicNoPutResultSetImpl- Returns:
- the next row in the result
- Throws:
StandardException- thrown if cursor finished.- See Also:
-
getNextParentRow
- Throws:
StandardException
-
openHeapConglomerateController
- Throws:
StandardException
-
close
Close the all the opens we did in this result set.- Specified by:
closein interfaceResultSet- Overrides:
closein classScanResultSet- Throws:
StandardException- if an error occurs
-
finish
Description copied from interface:ResultSetTells 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:
finishin interfaceResultSet- Overrides:
finishin classBasicNoPutResultSetImpl- Throws:
StandardException- on error
-
openCore
Description copied from interface:NoPutResultSetopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...openCore() can only be called on a closed result set. see reopenCore if you want to reuse an open result set.
For NoPutResultSet open() must only be called on the top ResultSet. Opening of NoPutResultSet's below the top result set are implemented by calling openCore.
- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown if cursor finished.
-
addNewSources
private void addNewSources() -
canGetInstantaneousLocks
boolean canGetInstantaneousLocks()Can we get instantaneous locks when getting share row locks at READ COMMITTED.- Specified by:
canGetInstantaneousLocksin classScanResultSet
-
getTimeSpent
public long getTimeSpent(int type) Description copied from interface:ResultSetReturn the total amount of time spent in this ResultSet- Specified by:
getTimeSpentin 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).
-
getRowLocation
Description copied from interface:CursorResultSetReturns 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.- Specified by:
getRowLocationin interfaceCursorResultSet- Returns:
- the row location of the current cursor row.
- Throws:
StandardException- thrown on failure to get location from storage engine
-
getCurrentRow
Description copied from interface:CursorResultSetReturns the current row of the result set. REMIND: eventually, this will only return the current row for result sets that need to return it; either some field in the activation or a parameter in the constructor will be used to signal that this needs to function. This will let us limit the number of live objects we are holding on to.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- the last row returned by getNextRow. null if closed.
- Throws:
StandardException- thrown on failure.
-
getScanProperties
-
printStartPosition
-
printStopPosition
-
printPosition
Return a start or stop positioner as a String. If we already generated the information, then use that. Otherwise, invoke the activation to get it. -
printQualifiers
Return an array of Qualifiers as a String
-