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

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.GenericConstantAction
      extended byorg.apache.derby.impl.sql.execute.DDLConstantAction
          extended byorg.apache.derby.impl.sql.execute.SetConstraintsConstantAction
All Implemented Interfaces:
ConstantAction

class SetConstraintsConstantAction
extends DDLConstantAction

This class describes actions that are performed for a set constraint at Execution time.

Note that the dependency action we send is SET_CONSTRAINTS rather than ALTER_TABLE. We do this because we want to distinguish SET_CONSTRAINTS from ALTER_TABLE for error messages.

Author:
jamie

Field Summary
private  ConstraintDescriptorList cdl
           
private  UUID[] cuuids
           
private  boolean enable
           
private  UUID[] tuuids
           
private  boolean unconditionallyEnforce
           
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction
RUNTIMESTATISTICS, STATISTICSTIMING
 
Constructor Summary
(package private) SetConstraintsConstantAction(ConstraintDescriptorList cdl, boolean enable, boolean unconditionallyEnforce)
          Boilerplate
 
Method Summary
 void executeConstantAction(Activation activation)
          This is the guts of the Execution-time logic for DROP CONSTRAINT.
private  ConstraintDescriptorList getConstraintDescriptorList(DataDictionary dd)
           
private  RowLocation getRowLocation(DataDictionary dd, TableDescriptor td, TransactionController tc)
           
 boolean modifiesTableId(UUID tableId)
          Does this constant action modify the passed in table uuid?
protected  void publishToTargets(Activation activation)
          Do the work of publishing any this action to any replication targets.
 java.lang.String toString()
           
private  void validateAllCheckConstraints(LanguageConnectionContext lcc, java.util.Hashtable ht)
           
private  void validateFKConstraint(ForeignKeyConstraintDescriptor fk, DataDictionary dd, TransactionController tc, ContextManager cm)
           
 
Methods inherited from class org.apache.derby.impl.sql.execute.DDLConstantAction
constructToString, getAndCheckSchemaDescriptor, getSchemaDescriptorForCreate, lockTableForDDL, readExternal, upToDate, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

enable

private boolean enable

unconditionallyEnforce

private boolean unconditionallyEnforce

cdl

private ConstraintDescriptorList cdl

cuuids

private UUID[] cuuids

tuuids

private UUID[] tuuids
Constructor Detail

SetConstraintsConstantAction

SetConstraintsConstantAction(ConstraintDescriptorList cdl,
                             boolean enable,
                             boolean unconditionallyEnforce)
Boilerplate

Parameters:
cdl - ConstraintDescriptorList
enable - true == turn them on, false == turn them off
unconditionallyEnforce - Replication sets this to true at the end of REFRESH. This forces us to run the included foreign key constraints even if they're already marked ENABLED.
Method Detail

toString

public java.lang.String toString()

executeConstantAction

public void executeConstantAction(Activation activation)
                           throws StandardException
This is the guts of the Execution-time logic for DROP CONSTRAINT.

Parameters:
activation - The execution environment for this constant action.
Throws:
StandardException - Thrown on failure
See Also:
ConstantAction.executeConstantAction(org.apache.derby.iapi.sql.Activation)

validateAllCheckConstraints

private void validateAllCheckConstraints(LanguageConnectionContext lcc,
                                         java.util.Hashtable ht)
                                  throws StandardException
Throws:
StandardException

validateFKConstraint

private void validateFKConstraint(ForeignKeyConstraintDescriptor fk,
                                  DataDictionary dd,
                                  TransactionController tc,
                                  ContextManager cm)
                           throws StandardException
Throws:
StandardException

getRowLocation

private RowLocation getRowLocation(DataDictionary dd,
                                   TableDescriptor td,
                                   TransactionController tc)
                            throws StandardException
Throws:
StandardException

getConstraintDescriptorList

private ConstraintDescriptorList getConstraintDescriptorList(DataDictionary dd)
                                                      throws StandardException
Throws:
StandardException

modifiesTableId

public boolean modifiesTableId(UUID tableId)
                        throws StandardException
Does this constant action modify the passed in table uuid? By modify we mean add or drop things tied to this table (e.g. index, trigger, constraint). Things like views or spses that reference this table don't count.

For SET CONSTRAINTS return true if it is SET CONSTRAINTS ALL otherwise, compare the table ids.

Specified by:
modifiesTableId in interface ConstantAction
Overrides:
modifiesTableId in class DDLConstantAction
Parameters:
tableId - the table id
Throws:
StandardException - on error

publishToTargets

protected void publishToTargets(Activation activation)
                         throws StandardException
Do the work of publishing any this action to any replication targets. On a non-replicated source, this is a no-op.

Parameters:
activation - the activation
Throws:
StandardException - on error


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.