## org.eclipse.datatools.modelbase.sql.constraints
Interface Constraint

All Superinterfaces:
  SQLObject

All Known Subinterfaces:
  Assertion, CheckConstraint, ForeignKey, PrimaryKey, ReferenceConstraint, TableConstraint, UniqueConstraint

All Known Implementing Classes:
  AssertionImpl, CheckConstraintImpl, ConstraintImpl, ForeignKeyImpl, PrimaryKeyImpl, ReferenceConstraintImpl, TableConstraintImpl, UniqueConstraintImpl

public interface Constraint
extends SQLObject

A representation of the model object 'Constraint'. 4.17 Integrity constraints Integrity constraints, generally referred to simply as constraints, define the valid states of SQL-data by constrain-ing the values in the base tables. A constraint is either a table constraint, a domain constraint or an assertion. A constraint is described by a constraint descriptor. A constraint descriptor is either a table constraint descriptor, a domain constraint descriptor or an assertion descriptor. Every constraint descriptor includes: - The name of the constraint. - An indication of whether or not the constraint is deferrable. - An indication of whether the initial constraint mode is deferred or immediate. No integrity constraint shall be defined using a that is not retrospectively deterministic. The checking of a constraint depends on its constraint mode within the current SQL-transaction. If the constraint mode is immediate, then the constraint is effectively checked at the end of each SQL-statement. If the constraint mode is deferred, then the constraint is effectively checked when the constraint mode is changed to immediate either explicitly by execution of a <set constraints mode statement> , or implicitly at the end of the current SQL-transaction. A table constraint is either a unique constraint, a referential constraint or a table check constraint. A domain constraint is a constraint that is specified for a domain. It is applied to all columns that are based on that domain, and to all values cast to that domain. An assertion is a named constraint that may relate to the content of individual rows of a table, to the entire contents of a table, or to a state required to exist among a number of tables. 10.8 2) The <qualified identifier> of <constraint name> shall not be equivalent to the <qualified identifier> of the <constraint name> of any other constraint defined in the same schema. 3) If <constraint check time> is not specified, then INITIALLY IMMEDIATE is implicit. 4) Case: a) If INITIALLY DEFERRED is specified, then: i) NOT DEFERRABLE shall not be specified. ii) If DEFERRABLE is not specified, then DEFERRABLE is implicit.

The following features are supported:

- `Deferrable`
- `Initially Deferred`
- `Enforced`

See Also:
  `SQLConstraintsPackage.getConstraint()`

Method Summary
`boolean` `isDeferrable()` Returns the value of the 'Deferrable' attribute.
`boolean` `isEnforced()` Returns the value of the 'Enforced' attribute.
`boolean` `isInitiallyDeferred()` Returns the value of the 'Initially Deferred' attribute.
`void` `setDeferrable(boolean value)` Sets the value of the '`Deferrable`' attribute.
`void` `setEnforced(boolean value)` Sets the value of the '`Enforced`' attribute.
`void` `setInitiallyDeferred(boolean value)` Sets the value of the '`Initially Deferred`' attribute.

Methods inherited from interface org.eclipse.datatools.modelbase.sql.schema.SQLObject
`addEAnnotation, addEAnnotationDetail, getDependencies, getDescription, getEAnnotation, getEAnnotationDetail, getLabel, removeEAnnotationDetail, setAnnotationDetail, setDescription, setLabel`

Method Detail

### isDeferrable

    public boolean isDeferrable()

  Returns the value of the 'Deferrable' attribute. If True allows you to specify when the DBMS should check the constraint for violation (statement end or transaction end). If False it will always be after statement end. Could also be named deferralMode with values DEFERRABLE and NOT DEFERRABLE.

  Returns:
    the value of the 'Deferrable' attribute.
  See Also:
    `setDeferrable(boolean)`, `SQLConstraintsPackage.getConstraint_Deferrable()`

### setDeferrable

    public void setDeferrable(boolean value)

  Sets the value of the '`Deferrable`' attribute.

  Parameters:
    `value` - the new value of the 'Deferrable' attribute.
  See Also:
    `isDeferrable()`

### isInitiallyDeferred

    public boolean isInitiallyDeferred()

  Returns the value of the 'Initially Deferred' attribute. The default value is `"false"`. If True isDeferrable must be True and constraint check time will be DEFERRED. If False constraint check time will be IMMEDIATE. Could also be named (initial)ConstraintCheckTime with values INITIALLY DEFERRED and INITIALLY IMMEDIATE. Default value would be INITIALLY IMMEDIATE.

  Returns:
    the value of the 'Initially Deferred' attribute.
  See Also:
    `setInitiallyDeferred(boolean)`, `SQLConstraintsPackage.getConstraint_InitiallyDeferred()`

### setInitiallyDeferred

    public void setInitiallyDeferred(boolean value)

  Sets the value of the '`Initially Deferred`' attribute.

  Parameters:
    `value` - the new value of the 'Initially Deferred' attribute.
  See Also:
    `isInitiallyDeferred()`

### isEnforced

    public boolean isEnforced()

  Returns the value of the 'Enforced' attribute. The default value is `"true"`.

  If the meaning of the 'Enforced' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Enforced' attribute.
  See Also:
    `setEnforced(boolean)`, `SQLConstraintsPackage.getConstraint_Enforced()`

### setEnforced

    public void setEnforced(boolean value)

  Sets the value of the '`Enforced`' attribute.

  Parameters:
    `value` - the new value of the 'Enforced' attribute.
  See Also:
    `isEnforced()`

Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.