Responding to Events

From InterBase

Go Up to Working with Events

When event notification occurs, a suspended application resumes normal processing at the next statement following EVENT WAIT.

If an application has registered interest in more than one event with a single EVENT INIT call, then the application must determine which event occurred by examining the event array, isc_event[]. The event array is automatically created for an application during preprocessing. Each element in the array corresponds to an event name passed as an argument to EVENT INIT. The value of each element is the number of times that event occurred since execution of the last EVENT WAIT statement with the same request handle.

In the following code, an application registers interest in three events, then suspends operation pending event notification:

EVENT INIT RESPOND_MANY ('new_order', 'change_order',

When any of the “new_order,” “change_order,” or “cancel_order” events are posted and their controlling transactions commit, the event manager notifies the application and processing resumes. The following code illustrates how an application might test which event occurred:

for (i = 0; i < 3; i++)
if (isc_$event[i] > 0)
/* this event occurred, so process it */
. . .

Advance To: