Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.sql.execute
Class ConstraintConstantAction  view ConstraintConstantAction download ConstraintConstantAction.java

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.DDLSingleTableConstantAction
              extended byorg.apache.derby.impl.sql.execute.ConstraintConstantAction
All Implemented Interfaces:
org.apache.derby.iapi.sql.execute.ConstantAction
Direct Known Subclasses:
CreateConstraintConstantAction, DropConstraintConstantAction

public abstract class ConstraintConstantAction
extends DDLSingleTableConstantAction

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

Version:
0.1

Field Summary
protected  java.lang.String constraintName
           
protected  int constraintType
           
protected  IndexConstantAction indexAction
           
protected  org.apache.derby.catalog.UUID schemaId
           
protected  java.lang.String schemaName
           
protected  org.apache.derby.catalog.UUID tableId
           
protected  java.lang.String tableName
           
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction
RUNTIMESTATISTICS, STATISTICSTIMING
 
Constructor Summary
(package private) ConstraintConstantAction(java.lang.String constraintName, int constraintType, java.lang.String tableName, org.apache.derby.catalog.UUID tableId, java.lang.String schemaName, IndexConstantAction indexAction)
          Make one of these puppies.
 
Method Summary
 java.lang.String getConstraintName()
          Get the constraint name
 int getConstraintType()
          Get the constraint type.
 IndexConstantAction getIndexAction()
          Get the associated index constant action.
 boolean modifiesTableId(org.apache.derby.catalog.UUID tableId)
          Does this constant action modify the passed in table uuid? By modify we mean add or drop things tied to this table (e.g.
(package private) static boolean validateConstraint(java.lang.String constraintName, java.lang.String constraintText, org.apache.derby.iapi.sql.dictionary.TableDescriptor td, org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc, boolean isCheckConstraint)
          Evaluate a check constraint or not null column constraint.
(package private) static void validateFKConstraint(org.apache.derby.iapi.store.access.TransactionController tc, org.apache.derby.iapi.sql.dictionary.DataDictionary dd, org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor fk, org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor refcd, org.apache.derby.iapi.sql.execute.ExecRow indexTemplateRow)
          Make sure that the foreign key constraint is valid with the existing data in the target table.
 
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, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction
executeConstantAction
 

Field Detail

constraintName

protected java.lang.String constraintName

constraintType

protected int constraintType

tableName

protected java.lang.String tableName

schemaName

protected java.lang.String schemaName

schemaId

protected org.apache.derby.catalog.UUID schemaId

indexAction

protected IndexConstantAction indexAction

tableId

protected org.apache.derby.catalog.UUID tableId
Constructor Detail

ConstraintConstantAction

ConstraintConstantAction(java.lang.String constraintName,
                         int constraintType,
                         java.lang.String tableName,
                         org.apache.derby.catalog.UUID tableId,
                         java.lang.String schemaName,
                         IndexConstantAction indexAction)
Make one of these puppies.

Method Detail

getConstraintType

public int getConstraintType()
Get the constraint type.


getConstraintName

public java.lang.String getConstraintName()
Get the constraint name


getIndexAction

public IndexConstantAction getIndexAction()
Get the associated index constant action.


validateFKConstraint

static void validateFKConstraint(org.apache.derby.iapi.store.access.TransactionController tc,
                                 org.apache.derby.iapi.sql.dictionary.DataDictionary dd,
                                 org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor fk,
                                 org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor refcd,
                                 org.apache.derby.iapi.sql.execute.ExecRow indexTemplateRow)
                          throws org.apache.derby.iapi.error.StandardException
Make sure that the foreign key constraint is valid with the existing data in the target table. Open the table, if there aren't any rows, ok. If there are rows, open a scan on the referenced key with table locking at level 2. Pass in the scans to the BulkRIChecker. If any rows fail, barf.


validateConstraint

static boolean validateConstraint(java.lang.String constraintName,
                                  java.lang.String constraintText,
                                  org.apache.derby.iapi.sql.dictionary.TableDescriptor td,
                                  org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
                                  boolean isCheckConstraint)
                           throws org.apache.derby.iapi.error.StandardException
Evaluate a check constraint or not null column constraint. Generate a query of the form SELECT COUNT(*) FROM t where NOT() and run it by compiling and executing it. Will work ok if the table is empty and query returns null.


modifiesTableId

public boolean modifiesTableId(org.apache.derby.catalog.UUID tableId)
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.

Specified by:
modifiesTableId in interface org.apache.derby.iapi.sql.execute.ConstantAction
Overrides:
modifiesTableId in class DDLConstantAction