The mi_default_callback() function

The mi_default_callback() function is the system-default callback for all callbacks in a client LIBMI application.

Syntax

void mi_default_callback(event_type, conn, event_data, user_data)
   MI_EVENT_TYPE event_type;
   MI_CONNECTION *conn;
   void *event_data;
   void *user_data;
event_type
The event type that the system-default callback is to handle.
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
event_data
A pointer to the event-specific structure for the callback.
user_data
is a pointer to the user-defined error structure. For the MI_LIB_DROPCONN error level of the MI_Client_Library_Error event, this argument A flag to indicate whether to attempt a reconnection. If user_data is set to zero, the client LIBMI library attempts to reconnect to the database server; otherwise, no attempt is made to reconnect.
Valid in client LIBMI application? Valid in user-defined routine?
Yes No

Usage

The mi_default_callback() function implements the system-default callback, which returns appropriate error and warning messages in response to client events. Client events include the MI_Client_Library_Error and MI_Exception events.

On UNIX or Linux, the system-default callback sends the error or warning message to stderr.

On Windows, the system-default callback displays the error or warning message in a Windows message box.

The client LIBMI library automatically calls the system-default callback when a client event occurs and the client LIBMI application has no callback registered for this event. A client LIBMI application can explicitly call mi_default_callback(). For example, an application can register a special callback within a specific function and then re-register mi_default_callback() after the function completes to return to default behavior.
Important: When a client LIBMI application connects to a database server, the mi_default_callback() function does not report some warnings. The SQLSTATE values for these warnings begin with 01I.

To override the default behavior of the system-default callback, the client application can register a callback that handles the client event with the mi_default_callback() function.

Return values

None.