The mi_get_database_info() function

The mi_get_database_info() function populates a database-information descriptor with current database parameters for an open connection.

Syntax

mi_integer mi_get_database_info(conn, db_info)
   MI_CONNECTION *conn;
   MI_DATABASE_INFO *db_info;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
db_info
A pointer to a user-provided database-information descriptor, which stores the current database parameters.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_database_info() function puts the current database parameters for the connection that conn references into the database-information descriptor (MI_DATABASE_INFO structure) that db_info references. The database parameters include the name of the database, the user account, and the account password. The following table shows the fields in the database-information descriptor.
Field Data type Description
database_name char * The name of the database
user_name char * The user account name, as defined by the operating system
password char * The account password, as defined by the operating system
Tip: You must allocate this database-information descriptor before you call mi_get_database_info().

The mi_get_database_info() function also initializes the DataBlade® API when it is the first DataBlade® API function in a client LIBMI application or a user-defined routine.

Server only: In a user-defined routine, mi_get_database_info() retrieves the same information as the mi_get_default_database_info() function.

For a description of the database-information descriptor, more information about how to examine the database-information descriptor, or more information about ways to interact with the session environment, see the Informix® DataBlade® API Programmer's Guide.

Return values

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