Restrictions on content

A callback can call a DataBlade® API function to perform its task. Callbacks often clean up resources with such functions as mi_free(), mi_close(), and mi_lo_spec_free(). The MI_EXCEPTION, MI_END_SESSION, and MI_EVENT_POST_XACT callbacks cannot perform the following tasks:
  • Execute SQL statements
  • Raise database server exceptions
  • Register other callbacks
Server only:
The following types of callbacks are not subject to the same restrictions as other callbacks:
  • Commit-abort callback
  • End-of-statement callback
  • End-of-transaction callback
  • Savepoint callback
Specifically, these callbacks can raise an exception and they can register their own exception callbacks. If an end-of-transaction or end-of-statement callback issues a call to a DataBlade API function that generates an exception, the action taken depends on whether the callback has registered its own exception callback, as follows:
  • If the callback has not registered any exception callback, any failure of a DataBlade API function results in the return of the MI_ERROR or NULL failure code from the DataBlade API function.

    The callback must check for possible failure and take any necessary exception-handling tasks.

  • If the callback has registered an exception callback, control is thrown to the exception callback.
  • An MI_EVENT_POST_XACT callback cannot raise an error because the transaction has already been committed or rolled back.