Class CheckConstraint

java.lang.Object
com.exedio.cope.Feature
com.exedio.cope.CheckConstraint
All Implemented Interfaces:
Copyable, Serializable

public final class CheckConstraint extends Feature implements Copyable
See Also:
  • Constructor Details

    • CheckConstraint

      public CheckConstraint(Condition condition)
  • Method Details

    • copy

      public CheckConstraint copy(CopyMapper mapper)
      Specified by:
      copy in interface Copyable
    • getCondition

      public Condition getCondition()
    • isSupportedBySchemaIfSupportedByDialect

      public boolean isSupportedBySchemaIfSupportedByDialect()
      Return true iff this check constraint can be supported by a database dialect supporting check constraints. This is the case, iff all table columns mentioned by the condition if the check constraints are located within the same database table.

      The result of this method does not depend on SchemaInfo.supportsCheckConstraints(Model).

      If returns false, you should call check() for checking database consistency after any modifications of the database bypassing cope.

    • check

      public int check()
      Checks, whether the database fulfills this check constraint. Should be called for checking database consistency after any modifications of the database bypassing cope. Is needed especially iff isSupportedBySchemaIfSupportedByDialect() returns false.

      Returns the number of items violating the check constraint. As a consequence, this methods returns 0 (zero), iff the database fulfills this check constraint.