An implementation of referential integrity in which descriptions of referential constraints are compiled into meta-data descriptions of the constraint rules and specifications. The meta-data descriptions of the constraints are stored in the form of objects called relationship descriptors. Each relationship descriptor contains a complete description of a referential constraint, either directly or by means of pointers to other objects such as record and index descriptors which contain information comprised in the constraint's specification. The relationship descriptors are linked into two types of chains by symbolic pointers. One type of relationship descriptor chain connects all relationship descriptors which have a common parent table. The other type of relationship descriptor chain connects relationship descriptors with common dependent tables. Both types of chains are anchored in respective fields in the tables' record descriptors. The use of meta-data descriptors facilitates both ready modification of the constraints, and speedy enforcement of the constraints by a single, shared procedure which may be embedded in the data base manager.
A method, apparatus, system, and signal-bearing medium that, in an embodiment, receive a constraint command that specifies a parent table, a primary key in the parent table, a child table, and a foreign key in the child table, and enforce that all values for the primary key in the parent table are present in the foreign key in the child table. In an embodiment, the enforcing may include receiving an insert command, wherein the insert command specifies a target key, a target value for the target key, and a target table; determining whether the target table matches the parent table and whether, within a transaction that includes the insert command, the child table includes at least one row with a foreign key value that equals the target value of the primary key; inserting the target value in the target table if the determining is true; and returning an error otherwise.
A method, in a data processing system, of imposing constraints on data files which are changed by update statements, includes the steps of: a) identifying a particular object of the update O.sub.x and a particular attribute being updated; b) finding an applicable constraint based on the particular attribute being updated; c) converting the particular update object O.sub.x to at least one other object which is in the applicable constraint and is different than the update object O.sub.x ; and, d) generating an error message, if after the update, the applicable constraint is not satisfied by any object from the converting step.
An object access system for retrieving objects in response to requests identifying requested objects, the system comprising an access structure consisting of a plurality of tables where each table is identified by a unique table identifier and has a plurality of rows where each row has a plurality of fields and is identified by a unique primary key in one of the fields and where a field may also contain objects; a row index for each table, each row index having entries ordered on the primary key of the rows in the table where each entry points to a row of fields in the table; a table index ordered on the table identifier for the tables, the table index having an entry for each table which point to the row index for that table and access means, responsive to requests for an object having an associated table identifier and primary key, for searching the table index for the requested table identifier and for retrieving from the table index entry for the requested table identifier the pointer to the row index for the requested table identifier, searching the pointed to row index for the requested primary key and retrieving from the row index entry for the requested primary key the pointer to the row of fields and searching the pointed to row of field for the requested object and retrieving the requested object.
An improved method for consistent updates of redundant data in a database is achieved advantageously by providing a dependency model identifying source fields and respective derived fields. The model having the necessary information for dependent data to be identified and calculated on a change of respective source data according to some predetermined rules. Further, by recording changes, i.e., modifications to data involved in a redundancy, and propagating changes including cascaded changes directed to the derived fields using the rules defied in said dependency model. Advantageously, the dependency model is stored as a database table (2) and the changes are recorded in a change table in the database. The step of recording changes is separated from the step of propagating changes to derived fields in order to improve performance.
Apparatus and methods to identify a home fragment for a child row of a child table of a database, the home fragment for a row being the fragment in which the row is stored. A child key value of the child row is obtained and used to identify a fragment of a parent table that is correlated with the child key value of the child row. The child key value being the value of a child key attribute of the child row and represents a reference to a parent row in a parent table. The result is the home fragment for the child row that corresponds to identified fragment of a parent table that is correlated with the child key value of the child row.