Understanding the Event Mechanism (Embedded SQL Guide)
Go Up to Working with Events
In InterBase, an event is a message passed by a trigger or a stored procedure to the InterBase event manager to announce the occurrence of a specified condition or action, usually a database change such as an INSERT
, UPDATE
, or DELETE
. Events are passed by triggers or stored procedures only when the transaction under which they occur is committed.
The event manager maintains a list of events posted to it by triggers and stored procedures. It also maintains a list of applications that have registered an interest in events. Each time a new event is posted to it, the event manager notifies interested applications that the event has occurred.
Applications can respond to specific events that might be posted by a trigger or stored procedure, by:
- Indicating an interest in the events to the event manager.
- Waiting for an event notification.
- Determining which event occurred (if an application is waiting for more than one event to occur).
The InterBase event mechanism, then, consists of three parts:
- A trigger or stored procedure that posts an event to the event manager.
- The event manager that maintains an event queue and notifies applications when an event occurs.
- An application that registers interest in the event and waits for it to occur.
A second application that uses the event-posting stored procedure (or that fires the trigger) causes the event manager to notify the waiting application so that it can resume processing.