MySQL, C++: Retrieving auto-increment ID
- by Thomas Matthews
I have a table with an auto-incrementing ID. After inserting a new row, I would like to retrieve the new ID.
I found an article that used the MySQL function LAST_INSERT_ID(). The article says to create a new query and submit it.
I'm using MySQL Connector C++, Windows XP and Vista, and Visual Studio 9.
Here are my questions:
Is there an API, for the connector,
that will fetch the ID out of the
record?
Does the result set, after an
insert/append, contain the new ID?
The LAST_INSERT_ID is MySQL
specific. Is there an SQL
standard method for obtaining the new ID?