Documentation Home
MySQL 8.4 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


6.4.17 mysql_stmt_insert_id()

uint64_tmysql_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 anAUTO_INCREMENT field.

SeeSection 5.4.42, “mysql_insert_id()”, for more information.

Return Values

Value forAUTO_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.

Errors

None.