Home | Previous Page | Next Page   Function Descriptions >

mi_set_connection_user_data( )

The mi_set_connection_user_data( ) function associates the address of user data with an open connection.

Syntax

mi_integer mi_set_connection_user_data(conn, user_data_ptr)
   MI_CONNECTION *conn;
   void *user_data_ptr;
conn
is a pointer to a connection descriptor established by a previous call to mi_open( ), mi_server_connect( ), or mi_server_reconnect( ).

can be a pointer to a session-duration connection descriptor established by a previous call to mi_get_session_connection( ). Use of a session-duration connection descriptor is a advanced feature of the DataBlade API.

user_data_ptr
is a pointer to user data to associate with the specified connection.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
Yes Yes

Usage

The mi_set_connection_user_data( ) function assigns the user-data pointer that user_data_ptr references to the connection descriptor that conn references. The user-data pointer is the address to a user-defined buffer or structure that contains private information you want to keep with the specified connection.

The DataBlade API does not interpret or touch the associated user-data pointer, other than to store it in the connection descriptor. Cast the user_data_ptr pointer to void * before you store it as user data in a connection descriptor.

You can obtain the user-data pointer from a connection descriptor with the mi_get_connection_user_data( ) function.

Warning:
Session-duration function descriptors and named memory are advanced features of the DataBlade API. They can adversely affect your UDR if you use them incorrectly. Use them only when a regular function descriptor cannot perform the task you need done. For more information, see the IBM Informix: DataBlade API Programmer's Guide.

Return Values

MI_OK
indicates that the function was successful.
MI_ERROR
indicates that the function was not successful.

Related Topics

See also the description of mi_get_connection_user_data( ).

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]