[Lazarus] TSQLQuery: Getting autoincremented ID value after insert (MySQL)

Reimar Grabowski reimgrab at web.de
Fri Nov 14 17:12:52 CET 2014


On Fri, 14 Nov 2014 12:49:44 -0300
silvioprog <silvioprog at gmail.com> wrote:

<snip> 
> This means that the value returned by the function to a given
> client is the first AUTO_INCREMENT value generated for most recent
> statement affecting an AUTO_INCREMENT column *by that client*.
Just to clarify, the 'first' here is important as it means that if you insert multiple rows in one statement you will get the first generated id and not the last one as some might expect (see http://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_last-insert-id).

R.




More information about the Lazarus mailing list