Database Reference
In-Depth Information
Of course, the preceding trigger function is quite useless, as will be any trigger
without knowing when and on what data change the trigger was called. All the data
needed by a trigger when it is called is passed in via the trigger dictionary , called
TD . In TD, you have the following values:
Key
Value
The event the trigger function is called for; one of the fol-
lowing strings is contained as the event:
TD["event"]
INSERT , UPDATE , DELETE , or TRUNCATE
One of BEFORE , AFTER , or INSTEAD OF .
TD["when"]
TD["level"]
ROW or STATEMENT .
This is the before-command image of the row. For low-
level UPDATE and DELETE triggers, this contains a dic-
tionary for the values of the triggering row before the
changes have been made by the command. It is None
for other cases.
TD["old"]
This is the after-command image of the row. For low-
level INSERT and UPDATE triggers, this contains a dic-
tionary for the values of the triggering row after the
changes have been made by the command. It is None
for other cases.
TD["new"]
If you are in a BEFORE or INSTEAD OF trigger, you can
make changes to this dictionary and then signal Post-
Search WWH ::




Custom Search