Class ForeignKeyConstraintDescriptor

    • 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 enforced,
                                                 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
        enforced - is the constraint enforced?
        raDeleteRule - The ON DELETE action rule
        raUpdateRule - The ON UPDATE action rule
      • 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 enforced,
                                       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
        enforced - true if this constraint is enforced
        raDeleteRule - The ON DELETE action rule
        raUpdateRule - The ON UPDATE action rule
    • Method Detail

      • 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)