The mi_last_serial8() function

The mi_last_serial8() function obtains the SERIAL8 value that the database server generated for the most recent INSERT statement on a SERIAL8 column.

Syntax

mi_integer mi_last_serial8(conn, serial8_val)
   MI_CONNECTION *conn;
   mi_int8 *serial8_val;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
serial8_val
A pointer to the new SERIAL8 value.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The database server automatically generates a value for a SERIAL8 column when it executes an INSERT statement on the column.

Server only: Use the mi_last_serial8() function to obtain the last system-generated SERIAL8 value for your C user-defined routine.
Client only: To use the mi_last_serial8() function in a client LIBMI application, call it after the insert operation is complete (when the mi_get_result() function returns the MI_DML statement).

You must also call mi_last_serial8() before any call to mi_query_finish() or mi_close().

Return values

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