The mi_close() function
The mi_close() function closes a connection.
Syntax
mi_integer mi_close(conn)
MI_CONNECTION *conn;
- conn
- A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_close() function
frees the connection descriptor that conn references. This
function is the destructor function for a connection descriptor. After mi_close() is
called, conn is no longer a valid open connection and all information
in the associated session context becomes invalid. This information
includes:
- Save sets created on the connection
- Callbacks registered for the connection
- Statement descriptors for the connection (both implicit and explicit)
- Cursors opened on the connection (with their associated rows)
- Function descriptors
The mi_close() function also deallocates the connection descriptor itself.
Server only: In a C UDR, the mi_close() function
closes a UDR connection, freeing the associated connection descriptor.
After a UDR connection closes, any open smart large objects and file
descriptors remain valid for the duration of the session. Use the mi_lo_close() function
to explicitly close a smart large object. Use the mi_file_close() function
to explicitly close an operating-system file.
Restriction: Do not use the mi_close() function
to free a session-duration connection descriptor. A session-duration
connection descriptor is valid until the end of the session.
Client only: In a client LIBMI application,
the mi_close() function closes a client connection,
freeing the associated connection descriptor. Closing a client connection
ends the session.
Return values
- MI_OK
- The function was successful.
- MI_ERROR
- The function was not successful.