org.apache.derby.iapi.sql.dictionary
Class ForeignKeyConstraintDescriptor

java.lang.Object
  extended by org.apache.derby.iapi.sql.dictionary.TupleDescriptor
      extended by org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor
          extended by org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor
              extended by org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor
All Implemented Interfaces:
Dependable, Dependent, Provider, UniqueTupleDescriptor

public class ForeignKeyConstraintDescriptor
extends KeyConstraintDescriptor

A foreign key.


Field Summary
(package private)  int raDeleteRule
           
(package private)  int raUpdateRule
           
(package private)  ReferencedKeyConstraintDescriptor referencedConstraintDescriptor
          interface to this descriptor public ReferencedKeyConstraintDescriptor getReferencedConstraint() throws StandardException; public UUID getReferencedConstraintId() throws StandardException; public boolean isSelfReferencingFK() throws StandardException;
(package private)  UUID referencedConstraintId
           
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor
indexId
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor
ALL, constraintId, constraintName, DISABLED, ENABLED, isEnabled, SYSCONSTRAINTS_STATE_FIELD, table
 
Fields inherited from interface org.apache.derby.catalog.Dependable
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
 
Constructor Summary
protected ForeignKeyConstraintDescriptor(DataDictionary dataDictionary, TableDescriptor table, java.lang.String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, ReferencedKeyConstraintDescriptor referencedConstraintDescriptor, boolean isEnabled, int raDeleteRule, int raUpdateRule)
          Constructor for a ForeignKeyConstraintDescriptor
(package private) ForeignKeyConstraintDescriptor(DataDictionary dataDictionary, TableDescriptor table, java.lang.String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, UUID referencedConstraintId, boolean isEnabled, int raDeleteRule, int raUpdateRule)
          Constructor for a ForeignKeyConstraintDescriptor
 
Method Summary
 int getConstraintType()
          Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).
 int getRaDeleteRule()
          Gets a referential action rule on a DELETE
 int getRaUpdateRule()
          Gets a referential action rule on a UPDATE
 ReferencedKeyConstraintDescriptor getReferencedConstraint()
          Get the constraint that this FK references.
 UUID getReferencedConstraintId()
          Get the constraint id for the constraint that this FK references.
 boolean isSelfReferencingFK()
          Am I a self-referencing FK?
 boolean needsToFire(int stmtType, int[] modifiedCols)
          Does this constraint need to fire on this type of DML?
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor
getConglomerateId, getIndexConglomerateDescriptor, getIndexId, getIndexUUIDString, hasBackingIndex, toString
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor
areColumnsComparable, columnIntersects, deferrable, doColumnsIntersect, drop, getClassType, getColumnDescriptors, getConstraintName, getConstraintText, getDependableFinder, getDescriptorName, getDescriptorType, getKeyColumns, getObjectID, getObjectName, getReferenceCount, getReferencedColumns, getSchemaDescriptor, getTableDescriptor, getTableId, getUUID, initiallyDeferred, isEnabled, isReferenced, isValid, makeInvalid, prepareToInvalidate, setDisabled, setEnabled
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, isPersistent, setDataDictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.catalog.Dependable
isPersistent
 

Field Detail

referencedConstraintDescriptor

ReferencedKeyConstraintDescriptor referencedConstraintDescriptor
interface to this descriptor
  1. public ReferencedKeyConstraintDescriptor getReferencedConstraint() throws StandardException;
  2. public UUID getReferencedConstraintId() throws StandardException;
  3. public boolean isSelfReferencingFK() throws StandardException;


referencedConstraintId

UUID referencedConstraintId

raDeleteRule

int raDeleteRule

raUpdateRule

int raUpdateRule
Constructor Detail

ForeignKeyConstraintDescriptor

protected ForeignKeyConstraintDescriptor(DataDictionary dataDictionary,
                                         TableDescriptor table,
                                         java.lang.String constraintName,
                                         boolean deferrable,
                                         boolean initiallyDeferred,
                                         int[] fkColumns,
                                         UUID constraintId,
                                         UUID indexId,
                                         SchemaDescriptor schemaDesc,
                                         ReferencedKeyConstraintDescriptor referencedConstraintDescriptor,
                                         boolean isEnabled,
                                         int raDeleteRule,
                                         int raUpdateRule)
Constructor for a ForeignKeyConstraintDescriptor

Parameters:
dataDictionary - The data dictionary that this descriptor lives in
table - The descriptor of the table the constraint is on
constraintName - The name of the constraint.
deferrable - If the constraint can be deferred.
initiallyDeferred - If the constraint starts life deferred.
fkColumns - columns in the foreign key
constraintId - UUID of constraint
indexId - The UUID for the backing index
schemaDesc - The SchemaDescriptor for the constraint
referencedConstraintDescriptor - is referenced constraint descriptor
isEnabled - is the constraint enabled?

ForeignKeyConstraintDescriptor

ForeignKeyConstraintDescriptor(DataDictionary dataDictionary,
                               TableDescriptor table,
                               java.lang.String constraintName,
                               boolean deferrable,
                               boolean initiallyDeferred,
                               int[] fkColumns,
                               UUID constraintId,
                               UUID indexId,
                               SchemaDescriptor schemaDesc,
                               UUID referencedConstraintId,
                               boolean isEnabled,
                               int raDeleteRule,
                               int raUpdateRule)
Constructor for a ForeignKeyConstraintDescriptor

Parameters:
dataDictionary - The data dictionary that this descriptor lives in
table - The descriptor of the table the constraint is on
constraintName - The name of the constraint.
deferrable - If the constraint can be deferred.
initiallyDeferred - If the constraint starts life deferred.
fkColumns - columns in the foreign key
constraintId - UUID of constraint
indexId - The UUID for the backing index
schemaDesc - The SchemaDescriptor for the constraint
referencedConstraintId - is referenced constraint id
isEnabled - is the constraint enabled?
Method Detail

getReferencedConstraint

public ReferencedKeyConstraintDescriptor getReferencedConstraint()
                                                          throws StandardException
Get the constraint that this FK references. Will return either a primary key or a unique key constriant.

Returns:
the constraint
Throws:
StandardException - on error

getReferencedConstraintId

public UUID getReferencedConstraintId()
                               throws StandardException
Get the constraint id for the constraint that this FK references. Will return either a primary key or a unique key constriant.

Returns:
the constraint id
Throws:
StandardException - on error

getConstraintType

public int getConstraintType()
Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

Specified by:
getConstraintType in class ConstraintDescriptor
Returns:
An identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

needsToFire

public boolean needsToFire(int stmtType,
                           int[] modifiedCols)
Does this constraint need to fire on this type of DML? True if insert or update and columns intersect

Specified by:
needsToFire in class ConstraintDescriptor
Parameters:
stmtType - the type of DML (StatementType.INSERT|StatementType.UPDATE|StatementType.DELETE)
modifiedCols - the columns modified, or null for all
Returns:
true/false

isSelfReferencingFK

public boolean isSelfReferencingFK()
                            throws StandardException
Am I a self-referencing FK? True if my referenced constraint is on the same table as me.

Returns:
true/false
Throws:
StandardException - on error

getRaDeleteRule

public int getRaDeleteRule()
Gets a referential action rule on a DELETE

Returns:
referential rule defined by the user during foreign key creattion for a delete (like CASCDE , RESTRICT ..etc)

getRaUpdateRule

public int getRaUpdateRule()
Gets a referential action rule on a UPDATE

Returns:
referential rule defined by the user during foreign key creattion for an UPDATE (like CASCDE , RESTRICT ..etc)

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

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