Class MsConstraintFk

All Implemented Interfaces:
IConstraint, IConstraintFk, ISearchPath, IStatement, ISubElement, IHashable

public class MsConstraintFk extends MsConstraint implements IConstraintFk
Represents a Microsoft SQL FOREIGN KEY constraint that enforces referential integrity between tables.
  • Constructor Details

    • MsConstraintFk

      public MsConstraintFk(String name)
      Creates a new Microsoft SQL FOREIGN KEY constraint.
      Parameters:
      name - the constraint name
  • Method Details

    • getDefinition

      public String getDefinition()
      Description copied from interface: IConstraint
      Gets the SQL definition of this constraint.
      Specified by:
      getDefinition in interface IConstraint
      Returns:
      the constraint definition
    • getColumns

      public List<String> getColumns()
      Description copied from interface: IConstraint
      Gets the columns involved in this constraint.
      Specified by:
      getColumns in interface IConstraint
      Overrides:
      getColumns in class MsConstraint
      Returns:
      a collection of column names
    • addColumn

      public void addColumn(String column)
      Adds a column to this foreign key constraint.
      Parameters:
      column - the column name to add
    • getForeignColumns

      public List<String> getForeignColumns()
      Description copied from interface: IConstraintFk
      Gets the foreign columns referenced by this foreign key.
      Specified by:
      getForeignColumns in interface IConstraintFk
      Returns:
      a collection of foreign column names
    • addForeignColumn

      public void addForeignColumn(String referencedColumn)
      Adds a referenced column to this foreign key constraint.
      Parameters:
      referencedColumn - the referenced column name to add
    • getForeignTable

      public String getForeignTable()
      Description copied from interface: IConstraintFk
      Gets the foreign table referenced by this foreign key.
      Specified by:
      getForeignTable in interface IConstraintFk
      Returns:
      the foreign table name
    • setForeignTable

      public void setForeignTable(String foreignTable)
    • getForeignSchema

      public String getForeignSchema()
      Description copied from interface: IConstraintFk
      Gets the foreign schema containing the referenced table.
      Specified by:
      getForeignSchema in interface IConstraintFk
      Returns:
      the foreign schema name
    • setForeignSchema

      public void setForeignSchema(String foreignSchema)
    • setDelAction

      public void setDelAction(String delAction)
    • setUpdAction

      public void setUpdAction(String updAction)
    • setNotForRepl

      public void setNotForRepl(boolean isNotForRepl)
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Overrides:
      computeHash in class MsConstraint
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(IStatement obj)
      Description copied from class: AbstractStatement
      This method does not account for nested child PgStatements. Shallow version of AbstractStatement.equals(Object)
      Specified by:
      compare in interface IStatement
      Overrides:
      compare in class MsConstraint