The mi_get_connection_option() function

The mi_get_connection_option() function returns information about the database of the current connection.

Syntax

mi_integer mi_get_connection_option(conn, conn_option, result_ptr)
   MI_CONNECTION *conn;
   const mi_integer conn_option;
   mi_integer *result_ptr;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
conn_option
An integer constant to indicate which connection attribute to obtain. For a list of valid constants, see the following “Usage” section.
result_ptr
A pointer to the connection information that mi_get_connection_option() obtains.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_connection_option() function puts information about the connection attribute that conn specifies in the location that result_ptr references.

The following table lists the valid values for conn_option and the associated possible values that result_ptr references.
Description Connection-option constant Result
Is the open database an ANSI-compliant database? MI_IS_ANSI_DB MI_TRUE or MI_FALSE
Does the open database use a transaction log? MI_IS_LOGGED_DB MI_TRUE or MI_FALSE
Is the database in exclusive mode?

(Has the DATABASE statement included the EXCLUSIVE keyword?)

MI_IS_EXCLUSIVE_DB MI_TRUE or MI_FALSE

This function copies this value into the buffer that result_ptr references. The function allocates memory for the result in the current memory duration. When you no longer need this result, free this memory.

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful or the conn_option argument is unknown.
The mi_get_connection_option() function raises an exception for the following conditions:
  • Parameter problems, such as bad or misaligned result pointer
  • An invalid connection