Dictionary Triggers

Top  Previous  Next

The Triggers interface of the Dictionary Editor allows you to enter Clarion source that can be applied before or after any data operation is performed on a selected table.

In the new Dictionary Explorer, triggers attached to any table are indicated by the following special icon:

A trigger can include any Clarion language statement to execute as a unit and can also invoke stored procedures defined in your application. However, procedures and triggers differ in the way that they are invoked. A procedure is explicitly executed by a user, application, or trigger. Triggers (one or more) are implicitly fired (executed) by the supported database when a triggering INSERT, UPDATE, or DELETE statement is issued, no matter which user is connected or which application is being used.

A Data button is also available on this window. The data elements that you add here apply to all trigger types created for the selected table.

 

Uses of Triggers

Triggers can supplement the standard capabilities of a database to provide a highly customized database management system. For example, a trigger can restrict operations against a table to those issued during regular business hours. A trigger could also restrict operations to occur only at certain times during weekdays. Other uses for triggers are to

·

automatically generate derived column values

·

prevent invalid transactions

·

enforce referential integrity across nodes in a distributed database

·

enforce complex business rules

·

provide transparent event logging

·

maintain synchronous table replicates

·

gather statistics on table access

·

store complex computed and conditional fields that are table related in one location

Triggers are an extremely powerful tool, but you need to spend some time planning the use of triggers. Consider that when a trigger is executed, if your trigger code accesses another table(s) that a table access statement can cause execution of another trigger(s).

 

See Also:

Trigger Properties

Dictionary (Client-Side) Triggers