MySQL :: MySQL 8.4 C API Developer Guide :: 6.4.17 mysql_stmt_insert_id() (original) (raw)

The world's most popular open source database

6.4.17 mysql_stmt_insert_id()

uint64_t
mysql_stmt_insert_id(MYSQL_STMT *stmt)

Description

Returns the value generated for anAUTO_INCREMENT column by the preparedINSERT orUPDATE statement. Use this function after you have executed a preparedINSERT statement on a table which contains an AUTO_INCREMENT field.

See Section 5.4.42, “mysql_insert_id()”, for more information.

Return Values

Value for AUTO_INCREMENT column which was automatically generated or explicitly set during execution of prepared statement, or value generated byLAST_INSERT_ID(expr) function. Return value is undefined if statement does not setAUTO_INCREMENT value.