Enforcing Entity Integrity; If A Client Application Breaches Entity Integrity - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Declaring entity and referential integrity

Enforcing entity integrity

Example 1
Example 2

If a client application breaches entity integrity

282
When a new row in a table is created, or when a row is updated, the database
server ensures that the primary key for the table is still valid: that each row in
the table is uniquely identified by the primary key.
Adaptive Server IQ enforces single-column primary keys only. No action
Note
is taken for invalid multi-column primary keys. If you have any multi-column
primary keys, you may want to define a procedure to use when you load or
insert data, that validates each set of values you insert in the primary key
columns.
You cannot create a join index that relies on a foreign key-primary key
relationship where the primary key is multi-column.
The
table in the sample database uses an employee ID as the primary
employee
key. When a new employee is added to the table, IQ checks that the new
employee ID value is unique, and is not NULL.
The
table in the sample database uses two columns to define
sales_order_items
a primary key.
This table holds information about items ordered. One column contains an
specifying an order, but there may be several items on each order, so this
column by itself cannot be a primary key. An additional
identifies which line corresponding to the item. The two columns
taken together, specify an item uniquely, and form the primary key.
Because it relies on multiple columns, this primary key is unenforced in the
current version of Adaptive Server IQ. However, you could create a stored
procedure to check insertions in both columns.
Entity integrity requires that each value of a primary key be unique within the
table, and that there are no NULL values. If a client application attempts to
insert or update a single-column primary key value, and provides values that
are not unique, entity integrity would be breached.
If an attempt to breach entity integrity is detected, Adaptive Server IQ does not
add the new information to the database, and instead reports an error to the
client application.
id
columns
line_id
and
,
id
line_id

Advertisement

Table of Contents
loading

Table of Contents