Show: Delphi C++
Display Preferences

Handling Server Constraints

From RAD Studio
Jump to: navigation, search

Go Up to Using Provider Components Index


Most relational database management systems implement constraints on their tables to enforce data integrity. A constraint is a rule that governs data values in tables and columns, or that governs data relationships across columns in different tables. For example, most SQL-92 compliant relational databases support the following constraints:

  • NOT NULL, to guarantee that a value supplied to a column has a value.
  • NOT NULL UNIQUE, to guarantee that column value has a value and does not duplicate any other value already in that column for another record.
  • CHECK, to guarantee that a value supplied to a column falls within a certain range, or is one of a limited number of possible values.
  • CONSTRAINT, a table-wide check constraint that applies to multiple columns.
  • PRIMARY KEY, to designate one or more columns as the table's primary key for indexing purposes.
  • FOREIGN KEY, to designate one or more columns in a table that reference another table.
Note: This list is not exclusive. Your database server may support some or all of these constraints in part or in whole, and may support additional constraints. For more information about supported constraints, see your server documentation.

Database server constraints obviously duplicate many kinds of data checks that traditional desktop database applications manage. You can take advantage of server constraints in multi-tiered database applications without having to duplicate the constraints in application server or client application code.

If the provider is working with a BDE-enabled dataset, the Constraints property lets you replicate and apply server constraints to data passed to and received from client datasets. When Constraints is True (the default), server constraints stored in the source dataset are included in data packets and affect client attempts to update data.

Warning: Before the provider can pass constraint information on to client datasets, it must retrieve the constraints from the database server.

There may be times when you do not want to apply server constraints to data sent to a client dataset. For example, a client dataset that receives data in packets and permits local updating of records prior to fetching more records may need to disable some server constraints that might be triggered because of the temporarily incomplete set of data. To prevent constraint replication from the provider to a client dataset, set Constraints to False. Note that client datasets can disable and enable constraints using the DisableConstraints and EnableConstraints methods. For more information about enabling and disabling constraints from the client dataset, see Handling constraints from the server.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance