Stored Procedures for Table Actions

When a user of the PT application adds, changes, or deletes records in the Eval database tables, stored procedures can execute those actions. To ensure that these stored procedures run as quickly as possible, the designers design the stored procedures to perform simple data modifications that do not include business logic. The constraints listed in the following table are enforced by FOREIGN KEY constraints, triggers, and other stored procedures. The business logic is performed in the COM components that reside on the business-services tier. Components in NLS.dll and Litware.dll describes the PT components.

The following table lists the Eval database tables, the actions (insert, update, and delete) the designers want to perform on the table, and the rules (constraints) that affect the table actions and the results of the table actions.

Table Action Constraints
Activity Insert, update, delete Cannot delete when PersonActivity records exist.

ActivityType must exist.

Group must exist.

GradeScale must exist.

Location must exist.

ActivityType Insert, update, delete Cannot delete when Activity records exist.

GradeScale must exist.

Grade Insert, update, delete Cannot delete when PersonActivity records exist.

GradeScale must exist.

GradeScale Insert, update, delete Cannot delete when Activity, ActivityType, Group, or PersonGroup records exist.
Group Insert, update, delete Cannot delete when Activity or PersonGroup records exist.

Location must exist.

Location Insert, update, delete Cannot delete when Activity or Group records exist.
Logon Insert, update, delete Cannot delete when Person records exist.

Person must exist.

Person Insert, update, delete Cannot delete when PersonActivity or PersonGroup records exist.
PersonActivity Insert, update, delete Cannot insert if count of PersonActivity records is greater than MaxSize in Group or MaxOccupancy in Location.

On insert and update, the RawScore must be adjusted by applicable late penalties, and the GradeId for the name of the grade that is equivalent to the AdjScore must be inserted.

On insert and update, the Average and StandardDeviation in Activity must be updated.

PersonGroup Insert, update, delete Cannot insert if the values in Size and MaxSize columns in Group are equal.

GradeScale must exist.

On insert (if insert is allowed), Size is updated.