6. Working with Transactions and Handling Errors : Error Handling : Error Handling in Embedded Applications : Event Handlers and Message Handlers
 
Share this page                  
Event Handlers and Message Handlers
In addition to error-handling routines, routines can be defined that enable embedded SQL applications to trap the following:
Event notifications:
To enable or disable an event-handling routine, issue the following SET_SQL statement:
exec sql set_sql(dbeventhandler = event_routine | 0)
When an event notification is received by your application, the specified routine is automatically called. To obtain the event notification information, the event handler routine must use the INQUIRE_SQL statement.
Messages from database procedures:
To enable or disable a message handling routine, issue the following SET_SQL statement:
exec sql set_sql(messagehandler = message_routine | 0)
The message handler routine traps all messages from database procedures, including messages from procedures that are executed when rules are fired.
Specify the routine as a function pointer. For more information about specifying function pointers, see the Embedded SQL Companion Guide.