The mi_get_row_desc_without_row() function

The mi_get_row_desc_without_row() function obtains the row descriptor for the current statement.

Syntax

MI_ROW_DESC *mi_get_row_desc_without_row(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_get_row_desc_without_row() function obtains the row descriptor for the current statement on the connection that conn references. The current statement is the most recently executed SQL statement sent to the database server on that connection.

Use mi_get_row_desc_without_row() to obtain a row descriptor for a query when the current statement was sent with the mi_exec() function. The mi_get_row_desc_without_row() function is useful when all the rows that the query returns are of the same type or when the statement is expected to return row data but no rows qualified.

The row descriptor is valid until one of the following conditions occurs:
  • The query finishes.
  • The mi_close() function is called on the connection.
Restriction: Do not use the mi_row_desc_free() function to free the row descriptor that mi_get_row_desc_without_row() allocates. Use mi_row_desc_free() only for row descriptors that you allocate with mi_row_desc_create().

After you obtain a row descriptor for the current statement, you can obtain the number of columns in the row with the mi_column_count() function. The number of columns determines the number of times to call the mi_value() or mi_value_by_name() function to obtain column values.

Return values

An MI_ROW_DESC pointer
A pointer to the row descriptor for the last query that returned rows on the specified connection.
NULL
The function was not successful or if the current statement is not a statement that returns rows.