Search code examples
mysql++

MySQL++ and AUTO_INCREMENT


Use to work with a MySQL + + (library for C + +)

The database has some fields for which you AUTO_INCREMENT. How to know what value will these fields when inserting a new row to the table?


Solution

  • You could use mysql_insert_id() C API function to retieve the auto-increment value after an insert. See also MySql Reference Manual