org.apache.derby.impl.sql.execute
Class DeleteCascadeResultSet

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
      extended by org.apache.derby.impl.sql.execute.DMLWriteResultSet
          extended by org.apache.derby.impl.sql.execute.DeleteResultSet
              extended by org.apache.derby.impl.sql.execute.DeleteCascadeResultSet
All Implemented Interfaces:
ResultSet

public 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
private  boolean affectedRows
           
 ResultSet[] dependentResultSets
           
private  long fkIndexConglomNumber
           
private  boolean mainNodeForTable
           
private  int noDependents
           
private  FKInfo parentFKInfo
           
private  CursorResultSet parentSource
           
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, resultDescription, rowHolder, savedSource, source
 
Fields inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
baseRowReadMap, constantAction, heapDCOCI, indexDCOCIs, 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
DeleteCascadeResultSet(NoPutResultSet source, Activation activation, int constantActionItem, ResultSet[] dependentResultSets, java.lang.String resultSetId)
           
 
Method Summary
 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.Hashtable msht)
           
private  boolean isMultipleDeletePathsExist()
           
private  void mergeResultSets()
           
private  void mergeRowHolders(java.util.Hashtable msht)
           
 void open()
          Needs to be called before the result set will do anything.
private  void rowChangerFinish()
           
(package private)  void runFkChecker(boolean restrictCheckOnly)
           
private  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
collectAffectedRows, createDependentSource, fireBeforeTriggers, getResultDescription
 
Methods inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
decodeLockMode, getIndexNameFromCID, getNextRowCore, makeDeferredSparseRow, modifiedRowCount
 
Methods inherited from class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
checkRowPosition, clearCurrentRow, close, doesCommit, evaluateACheckConstraint, evaluateCheckConstraints, evaluateGenerationClauses, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCurrentTimeMillis, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getQueryPlanText, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, returnsRows, setAfterLastRow, setBeforeFirstRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dependentResultSets

public ResultSet[] dependentResultSets

noDependents

private int noDependents

parentSource

private CursorResultSet parentSource

parentFKInfo

private FKInfo parentFKInfo

fkIndexConglomNumber

private long fkIndexConglomNumber

resultSetId

private 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 interface ResultSet
Overrides:
open in class DeleteResultSet
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 class DeleteResultSet
Throws:
StandardException - thrown on error

collectAffectedRows

boolean collectAffectedRows(boolean rowsFound)
                      throws StandardException
Throws:
StandardException

fireBeforeTriggers

void fireBeforeTriggers(java.util.Hashtable msht)
                  throws StandardException
Throws:
StandardException

fireAfterTriggers

void fireAfterTriggers()
                 throws StandardException
Overrides:
fireAfterTriggers in class DeleteResultSet
Throws:
StandardException

deleteDeferredRows

void deleteDeferredRows()
                  throws StandardException
Overrides:
deleteDeferredRows in class DeleteResultSet
Throws:
StandardException

runFkChecker

void runFkChecker(boolean restrictCheckOnly)
            throws StandardException
Overrides:
runFkChecker in class DeleteResultSet
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 interface ResultSet
Overrides:
cleanUp in class DeleteResultSet
Throws:
StandardException - Thrown on error
See Also:
ResultSet.cleanUp()

rowChangerFinish

private void rowChangerFinish()
                       throws StandardException
Throws:
StandardException

mergeRowHolders

private void mergeRowHolders(java.util.Hashtable 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 interface ResultSet
Overrides:
finish in class DeleteResultSet
Throws:
StandardException - on error

isMultipleDeletePathsExist

private boolean isMultipleDeletePathsExist()

setRowHoldersTypeToUniqueStream

private void setRowHoldersTypeToUniqueStream()

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.