Home |
Previous Page | Next Page Database Access > Executing User-Defined Routines > Obtaining Trigger Execution Information and HDR Database Server Status >
You can create user-defined routines that are invoked
in trigger action statements to obtain information about the triggers,
triggering tables, views, statements, and the values of rows involved
in the trigger actions. To create such a reporting routine, use the
DataBlade APIs described below. Using these DataBlade APIs, you
can write a general purpose user-defined routine that you can use
to audit any table and any trigger event.
DataBlade API Function |
Purpose |
mi_trigger_event( ) |
Returns the value derived from an OR operation
from the following events. These values are defined in the milib.h file.
- MI_TRIGGER_NOT_IN_EVENT
- MI_TRIGGER_INSERT_EVENT
- MI_TRIGGER_DELETE_EVENT
- MI_TRIGGER_UPDATE_EVENT
- MI_TRIGGER_SELECT_EVENT
- MI_TRIGGER_BEFORE_EVENT
- MI_TRIGGER_AFTER_EVENT
- MI_TRIGGER_FOREACH_EVENT
- MI_TRIGGER_INSTEAD_EVENT
- MI_TRIGGER_REMOTE_EVENT
Each bit set in the returned value indicates the type of trigger
currently executing. These definitions are in the public header
file. The returned value is combined with these values to determine
the current event. If the UDR is not currently executing, it returns MI_TRIGGER_NOT_IN_EVENT. |
mi_trigger_get_new_row( ) |
Returns the new row being inserted or the updated
value of the row. It returns NULL when called in other trigger action
statements. |
mi_trigger_get_old_row( ) |
Returns the row that was deleted or the value
of the row before it was updated. It returns NULL when called in other
trigger action statements. |
mi_trigger_level( ) |
Returns the nesting level of the current trigger.
The values returned begin at 1 and increment by 1 for each nesting
level, with a maximum of 61 levels. |
mi_trigger_name( ) |
Returns the name of the currently executing trigger
in the format ownername.triggername. |
mi_trigger_tabname( ) |
Returns the triggering table or view name. |
For the syntax of these functions and for more information about
their purposes, see the IBM Informix: DataBlade API Function Reference.
Home |
[ Top of Page | Previous Page | Next Page | Contents |
Index ]