Class DeleteCascadeResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
-
- org.apache.derby.impl.sql.execute.DMLWriteResultSet
-
- org.apache.derby.impl.sql.execute.DeleteResultSet
-
- org.apache.derby.impl.sql.execute.DeleteCascadeResultSet
-
- All Implemented Interfaces:
ResultSet
class DeleteCascadeResultSet extends DeleteResultSet
Delete the rows from the specified base table and executes delete/update on dependent tables depending on the referential actions specified. Note:(beetle:5197) Dependent Resultsets of DeleteCascade Resultset can in any one of the multiple resultsets generated for the same table because of multiple foreign key relationship to the same table. At the bind time , dependents are binded only once per table. We can not depend on mainNodeTable Flag to fire actions on dependents, it should be done based on whether the resultset has dependent resultsets or not.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
affectedRows
(package private) ResultSet[]
dependentResultSets
private boolean
mainNodeForTable
private int
noDependents
private java.lang.String
resultSetId
private int
tempRowHolderId
-
Fields inherited from class org.apache.derby.impl.sql.execute.DeleteResultSet
cascadeDelete, constants, deferredBaseCC, deferredBaseRow, deferredRLRow, deferredSparseRow, fkInfoArray, lockMode, numberOfBaseColumns, numIndexes, rc, rowHolder, savedSource, source
-
Fields inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
baseRowReadMap, cachedDestinations, constantAction, heapDCOCI, indexDCOCIs, resultDescription, rowCount, streamStorableHeapColIds
-
Fields inherited from class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
activation, beginExecutionTime, beginTime, endExecutionTime, endTime, lcc
-
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 DeleteCascadeResultSet(NoPutResultSet source, Activation activation, int constantActionItem, ResultSet[] dependentResultSets, java.lang.String resultSetId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Tells the system to clean up on an error.(package private) boolean
collectAffectedRows(boolean rowsFound)
(package private) void
deleteDeferredRows()
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().(package private) void
fireAfterTriggers()
(package private) void
fireBeforeTriggers(java.util.HashMap<java.lang.String,java.lang.String> msht)
private boolean
isMultipleDeletePathsExist()
private void
mergeResultSets()
private void
mergeRowHolders(java.util.HashMap<java.lang.String,java.lang.String> msht)
void
open()
Needs to be called before the result set will do anything.private void
rowChangerFinish()
(package private) void
runFkChecker(boolean restrictCheckOnly)
Make sure foreign key constraints are not violatedprivate void
setRowHoldersTypeToUniqueStream()
(package private) void
setup()
Gathers the rows that needs to be deleted/updated and creates a temporary resulsets that will be passed as source to its dependent result sets.-
Methods inherited from class org.apache.derby.impl.sql.execute.DeleteResultSet
close, collectAffectedRows, createDependentSource, fireBeforeTriggers
-
Methods inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
decodeLockMode, getIndexNameFromCID, getNextRowCore, getResultDescription, makeDeferredSparseRow, modifiedRowCount, normalizeRow, rememberConstraint
-
Methods inherited from class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
addWarning, checkRowPosition, clearCurrentRow, close, doesCommit, evaluateGenerationClauses, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCurrentTimeMillis, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getQueryPlanText, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
-
-
-
Field Detail
-
dependentResultSets
ResultSet[] dependentResultSets
-
noDependents
private int noDependents
-
resultSetId
private final java.lang.String resultSetId
-
mainNodeForTable
private boolean mainNodeForTable
-
affectedRows
private boolean affectedRows
-
tempRowHolderId
private int tempRowHolderId
-
-
Constructor Detail
-
DeleteCascadeResultSet
public DeleteCascadeResultSet(NoPutResultSet source, Activation activation, int constantActionItem, ResultSet[] dependentResultSets, java.lang.String resultSetId) throws StandardException
- Throws:
StandardException
-
-
Method Detail
-
open
public void open() throws StandardException
Description copied from interface:ResultSet
Needs to be called before the result set will do anything. Need to call before getNextRow(), or for a result set that doesn't return rows, this is the call that will cause all the work to be done.- Specified by:
open
in interfaceResultSet
- Overrides:
open
in classDeleteResultSet
- Throws:
StandardException
- Standard Derby error policy
-
setup
void setup() throws StandardException
Gathers the rows that needs to be deleted/updated and creates a temporary resulsets that will be passed as source to its dependent result sets.- Overrides:
setup
in classDeleteResultSet
- Throws:
StandardException
- thrown on error
-
collectAffectedRows
boolean collectAffectedRows(boolean rowsFound) throws StandardException
- Throws:
StandardException
-
fireBeforeTriggers
void fireBeforeTriggers(java.util.HashMap<java.lang.String,java.lang.String> msht) throws StandardException
- Throws:
StandardException
-
fireAfterTriggers
void fireAfterTriggers() throws StandardException
- Overrides:
fireAfterTriggers
in classDeleteResultSet
- Throws:
StandardException
-
deleteDeferredRows
void deleteDeferredRows() throws StandardException
- Overrides:
deleteDeferredRows
in classDeleteResultSet
- Throws:
StandardException
-
runFkChecker
void runFkChecker(boolean restrictCheckOnly) throws StandardException
Description copied from class:DeleteResultSet
Make sure foreign key constraints are not violated- Overrides:
runFkChecker
in classDeleteResultSet
- Throws:
StandardException
-
cleanUp
public void cleanUp() throws StandardException
Description copied from interface:ResultSet
Tells the system to clean up on an error.- Specified by:
cleanUp
in interfaceResultSet
- Overrides:
cleanUp
in classDeleteResultSet
- Throws:
StandardException
- Thrown on error- See Also:
ResultSet.cleanUp()
-
rowChangerFinish
private void rowChangerFinish() throws StandardException
- Throws:
StandardException
-
mergeRowHolders
private void mergeRowHolders(java.util.HashMap<java.lang.String,java.lang.String> msht) throws StandardException
- Throws:
StandardException
-
mergeResultSets
private void mergeResultSets() throws StandardException
- Throws:
StandardException
-
finish
public void finish() throws StandardException
Description copied from interface:ResultSet
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
- Overrides:
finish
in classDeleteResultSet
- Throws:
StandardException
- on error
-
isMultipleDeletePathsExist
private boolean isMultipleDeletePathsExist()
-
setRowHoldersTypeToUniqueStream
private void setRowHoldersTypeToUniqueStream()
-
-