The mi_retrieve_callback() function

The mi_retrieve_callback() function retrieves the handle of a registered callback.

Syntax

mi_integer mi_retrieve_callback(conn, event_type, cback_handle, 
   cback_func,user_data)
   MI_CONNECTION *conn;
   MI_EVENT_TYPE event_type;
   MI_CALLBACK_HANDLE *cback_handle;
   MI_CALLBACK_FUNC *cback_func;
   void **user_data;
conn
This value is either NULL or a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
event_type
The type of event that the cback_handle callback handles. For a list of valid event types, see the HCL OneDB™ DataBlade® API Programmer's Guide.
cback_handle
The callback handle from a previous call to mi_retrieve_callback().
cback_func
A pointer to the location at which to return a pointer to the callback function.
user_data
The user-supplied argument to the callback function.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_retrieve_callback() function returns a callback-function pointer (MI_CALLBACK_FUNC) when you pass in a callback handle (MI_CALLBACK_HANDLE). This function is useful when a DataBlade API module needs to temporarily change the callback that is registered for a particular event.

Server only: For a C UDR, conn must be NULL for the following event types:
  • MI_EVENT_SAVEPOINT
  • MI_EVENT_COMMIT_ABORT
  • MI_EVENT_POST_XACT
  • MI_EVENT_END_STMT
  • MI_EVENT_END_XACT
  • MI_EVENT_END_SESSION
Client only: For a client LIBMI application, you must provide a valid connection descriptor to mi_retrieve_callback() for callbacks that handle the following event types:
  • MI_Exception
  • MI_Xact_State_Change
  • MI_Client_Library_Error

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful.