Continue with exception handling

To indicate that the callback function executes in addition to the default exception handling, an exception callback function returns the MI_CB_CONTINUE return status. This return status tells the DataBlade® API that the actions of the callback have not completely handled the exception and that the DataBlade API must continue with its default exception handling.

The actions of the callback provide supplemental exception handling.

If the excpt_callback() function in A simple exception callback had returned MI_CB_CONTINUE instead of MI_CB_EXC_HANDLED, the database server would handle the exception in the has_exception_handling() routine as follows:
  1. Execute the excpt_callback() function when the mi_exec() call throws an exception.
  2. Abort the mi_exec() call in has_exception_handling().
  3. Return control back to the calling module that called has_exception_handling().

If has_exception_handling() was a UDR in an SQL statement, the database server would abort the SQL statement and return control to the client application. The client application would be expected to handle the runtime error for the end user.

However, if has_exception_handling() was called by another C UDR that had registered an exception callback, the database server would have executed this callback and continued with the exception handling as the return status of this callback indicated (MI_CB_CONTINUE or MI_CB_EXC_HANDLED). If this callback also returned MI_CB_CONTINUE, the database server would continue up the calling sequence, looking for a registered callback that handled the MI_Exception event. If the database server reached the top-most level in the calling sequence (the UDR within an SQL statement) without locating an exception callback that returned MI_CB_EXC_HANDLED, the database server would abort the UDR and return control to the client application.
Tip: The MI_Exception event might overlap with the MI_EVENT_END_STMT and MI_EVENT_END_XACT events because an exception always causes either a statement or a transaction to abort. Design the corresponding callbacks with this relationship in mind.