The mi_result_reference() function

The mi_result_reference() function returns the reference of the last object inserted on the connection.

Syntax

mi_integer mi_result_reference(conn, retbuf)
   MI_CONNECTION *conn;
   mi_ref *retbuf;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
retbuf
The reference of the new row. The retbuf parameter is set to 0 in any of the following cases:
  • The INSERT command is not over a named row type.
  • The INSERT command was not WITH REFERENCE.
  • Multiple rows are inserted.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_result() function must be called before mi_result_reference(). The mi_result_reference() function is valid only after an insert.

Return values

The reference of the last object inserted on the connection.