Adding or Dropping Constraints
The DB Interface Module provides various ways to manage your constraints. Methods on
RWDBTable add, drop or fetch constraints for an existing table.
Add or drop constraints from an existing table using the
RWDBTable methods
addConstraint() and
dropConstraint(). These methods are overloaded for each constraint type, i.e. primary key, foreign key, check, and unique constraints.
RWDBStatus addConstraint (const RWDBPrimaryKey &pk)
RWDBStatus addConstraint (const RWDBForeignKey &fk)
RWDBStatus addConstraint (const RWDBCheckConstraint &cc)
RWDBStatus addConstraint (const RWDBUniqueConstraint &uc)
To drop a constraint, use either the constraint name or the constraint object:
RWDBStatus dropConstraint (const RWCString &constraintName)
RWDBStatus dropConstraint (const RWDBPrimaryKey &pk)
RWDBStatus dropConstraint (const RWDBForeignKey &fk)
RWDBStatus dropConstraint (const RWDBCheckConstraint &cc)
RWDBStatus dropConstraint (const RWDBUniqueConstraint &uc)
(Each constraint type method also has an overload that takes an
RWDBConnection for an explicit connection.)