25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Triggers are, however, fired by the persistence methods used by the legacy storage class,<br />

%CacheSQLStorage as it uses SQL statements internally to implement its persistent behavior.<br />

13.2.4.1 Trigger Keywords<br />

The Object-SQL Projection<br />

A class definition may include a list of trigger definitions. A trigger definition consists of the<br />

following information:<br />

Code<br />

Event<br />

Name<br />

Order<br />

Time<br />

The <strong>Caché</strong> ObjectScript code to be executed when the specified trigger event occurs.<br />

Triggers fully support all <strong>Caché</strong> ObjectScript functionality including embedded SQL<br />

and object syntax.<br />

The event with which this trigger is associated. Possible events include INSERT,<br />

UPDATE, DELETE. Together with the Time value, this determines when a trigger<br />

is invoked.<br />

The name of the trigger. This must be unique within the extent of the trigger.<br />

A number indicating the order in which trigger actions are to be carried out when<br />

more than one trigger is defined for a specific event. If only one trigger is associated<br />

with a specific event its order must be set to 1. If more than one trigger is associated<br />

with a specific event, each must have a unique order value.<br />

Together with the Event keyword, Time determines when a trigger is invoked. The<br />

possible values of Time are BEFORE and AFTER.<br />

13.2.5 Relationships<br />

The SQL projection of a relationship depends on its cardinality value: The single-valued side<br />

(ONE or PARENT) is projected as a simple designative reference field. For example, the<br />

Employee table will have a field called TheCompany whose value is the ID of the related<br />

Company:<br />

<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!