The mi_close_statement() function
The mi_close_statement() function closes an open cursor.
Syntax
mi_integer mi_close_statement(stmt_desc)
MI_STATEMENT *stmt_desc;
- stmt_desc
- A pointer to a statement descriptor that identifies a prepared statement whose cursor has been opened with mi_open_prepared_statement().
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_close_statement() function
closes the cursor associated with the prepared statement that stmt_desc references.
This cursor is an explicit cursor, which the mi_open_prepared_statement() function
has opened. To close a cursor, mi_close_statement() clears
out all rows from the cursor. A cursor must be closed before it can
be opened again. After you close a cursor, you can reopen it with
another call to mi_open_prepared_statement(). After
the cursor is reopened, it is empty.
Important: When you
close a cursor, the cursor remains allocated. When you free a prepared
statement with mi_drop_prepared_statement(), the
prepared statement and the associated cursor are deallocated. You
must reprepare the statement with mi_prepare() to
reopen the cursor. It is recommended that you explicitly free cursors
with mi_drop_prepared_statement() once you no longer
need them; otherwise, prepared statements and their cursors remain
until the associated session ends.
Return values
- MI_OK
- The function was successful.
- MI_ERROR
- The function was not successful.