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

Quick Search    Search Deep

org.apache.derby.iapi.sql.dictionary
Class ReferencedKeyConstraintDescriptor  view ReferencedKeyConstraintDescriptor download ReferencedKeyConstraintDescriptor.java

java.lang.Object
  extended byorg.apache.derby.iapi.sql.dictionary.TupleDescriptor
      extended byorg.apache.derby.iapi.sql.dictionary.ConstraintDescriptor
          extended byorg.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor
              extended byorg.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor
All Implemented Interfaces:
org.apache.derby.catalog.Dependable, org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.iapi.sql.depend.Provider, UniqueTupleDescriptor

public class ReferencedKeyConstraintDescriptor
extends KeyConstraintDescriptor

A ReferencedConstraintDeescriptor is a primary key or a unique key that is referenced by a foreign key.


Field Summary
private  boolean checkedSelfReferencing
           
private  int constraintType
          public interface to this descriptor: public boolean hasSelfReferencingFK(ConstraintDescriptorList cdl, int type) throws StandardException; public ConstraintDescriptorList getForeignKeyConstraints(int type) throws StandardException; public boolean isReferenced(); public int getReferenceCount(); public int incrementReferenceCount(); public int decrementReferenceCount();
private  ConstraintDescriptorList fkConstraintList
           
private  ConstraintDescriptorList fkEnabledConstraintList
           
private  boolean hasSelfReferencing
           
(package private)  int referenceCount
           
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor
indexId
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor
ALL, colDL, constraintId, constraintName, deferrable, DISABLED, ENABLED, initiallyDeferred, isEnabled, referencedColumns, schemaDesc, SYSCONSTRAINTS_STATE_FIELD, table
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
COLUMN_LIST, CONGLOMERATE_LIST, CONSTRAINT_LIST, TRIGGER_LIST
 
Fields inherited from interface org.apache.derby.catalog.Dependable
ALIAS, COLUMNS_IN_TABLE, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PREPARED_STATEMENT, SCHEMA, STORED_PREPARED_STATEMENT, TABLE, TRIGGER, VIEW
 
Constructor Summary
protected ReferencedKeyConstraintDescriptor(int constraintType, DataDictionary dataDictionary, TableDescriptor table, java.lang.String constraintName, boolean deferrable, boolean initiallyDeferred, int[] columns, org.apache.derby.catalog.UUID constraintId, org.apache.derby.catalog.UUID indexId, SchemaDescriptor schemaDesc, boolean isEnabled, int referenceCount)
          Constructor for a KeyConstraintDescriptorImpl
 
Method Summary
private  void checkType(int type)
           
 int decrementReferenceCount()
          Decrement the reference count by one.
 int getConstraintType()
          Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).
 ConstraintDescriptorList getForeignKeyConstraints(int type)
          Get the referencing foreign key constraints
 int getReferenceCount()
          Get the number of enabled fks that reference this key.
 boolean hasNonSelfReferencingFK(int type)
          Am I referenced by a FK on another table?
 boolean hasSelfReferencingFK(ConstraintDescriptorList cdl, int type)
          Am I referenced by a FK on the same table?
 int incrementReferenceCount()
          Bump the reference count by one.
 boolean isReferenced()
          Is this constraint referenced? Returns true if there are enabled fks that reference this constraint.
 boolean needsToFire(int stmtType, int[] modifiedCols)
          Does this constraint need to fire on this type of DML? For referenced keys, fire if referenced by a fk, and stmt is delete or bulk insert replace, or stmt is update and columns intersect.
 
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, getClassType, getColumnDescriptors, getConstraintName, getConstraintText, getDependableFinder, getDescriptorName, getDescriptorType, getKeyColumns, getObjectID, getObjectName, getReferencedColumns, getSchemaDescriptor, getTableDescriptor, getTableId, getUUID, initiallyDeferred, isEnabled, isValid, makeInvalid, makeValid, prepareToInvalidate, setConstraintId, 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

constraintType

private final int constraintType
public interface to this descriptor:
  1. public boolean hasSelfReferencingFK(ConstraintDescriptorList cdl, int type) throws StandardException;
  2. public ConstraintDescriptorList getForeignKeyConstraints(int type) throws StandardException;
  3. public boolean isReferenced();
  4. public int getReferenceCount();
  5. public int incrementReferenceCount();
  6. public int decrementReferenceCount();


referenceCount

int referenceCount

fkEnabledConstraintList

private ConstraintDescriptorList fkEnabledConstraintList

fkConstraintList

private ConstraintDescriptorList fkConstraintList

checkedSelfReferencing

private boolean checkedSelfReferencing

hasSelfReferencing

private boolean hasSelfReferencing
Constructor Detail

ReferencedKeyConstraintDescriptor

protected ReferencedKeyConstraintDescriptor(int constraintType,
                                            DataDictionary dataDictionary,
                                            TableDescriptor table,
                                            java.lang.String constraintName,
                                            boolean deferrable,
                                            boolean initiallyDeferred,
                                            int[] columns,
                                            org.apache.derby.catalog.UUID constraintId,
                                            org.apache.derby.catalog.UUID indexId,
                                            SchemaDescriptor schemaDesc,
                                            boolean isEnabled,
                                            int referenceCount)
Constructor for a KeyConstraintDescriptorImpl

Method Detail

getConstraintType

public final int getConstraintType()
Description copied from class: ConstraintDescriptor
Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

Specified by:
getConstraintType in class ConstraintDescriptor

hasSelfReferencingFK

public boolean hasSelfReferencingFK(ConstraintDescriptorList cdl,
                                    int type)
                             throws org.apache.derby.iapi.error.StandardException
Am I referenced by a FK on the same table?


hasNonSelfReferencingFK

public boolean hasNonSelfReferencingFK(int type)
                                throws org.apache.derby.iapi.error.StandardException
Am I referenced by a FK on another table?


getForeignKeyConstraints

public ConstraintDescriptorList getForeignKeyConstraints(int type)
                                                  throws org.apache.derby.iapi.error.StandardException
Get the referencing foreign key constraints


isReferenced

public boolean isReferenced()
Is this constraint referenced? Returns true if there are enabled fks that reference this constraint.

Overrides:
isReferenced in class ConstraintDescriptor

getReferenceCount

public int getReferenceCount()
Get the number of enabled fks that reference this key.

Overrides:
getReferenceCount in class ConstraintDescriptor

incrementReferenceCount

public int incrementReferenceCount()
Bump the reference count by one.


decrementReferenceCount

public int decrementReferenceCount()
Decrement the reference count by one.


needsToFire

public boolean needsToFire(int stmtType,
                           int[] modifiedCols)
Does this constraint need to fire on this type of DML? For referenced keys, fire if referenced by a fk, and stmt is delete or bulk insert replace, or stmt is update and columns intersect.

Specified by:
needsToFire in class ConstraintDescriptor

checkType

private void checkType(int type)
                throws org.apache.derby.iapi.error.StandardException