On Fri, Nov 14, 2014 at 11:43 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: [...]
> AFAIK Only sqlite does not (maybe it does today). But that is not a DBMS > :-) Yes. It would be nice execute the "last_insert_rowid()" to return it in the same cursor (AFAIK, Android SDK use this mechanism in the nativeExecuteForLastInsertedRowId). So it can be same to the MySQL (LAST_INSERT_ID()). =) And you can use the TSQLite3Connection.getinsertid method, no? =/ E.g in a simple raw query in MySQL: =============================================================================================== INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...); SELECT LAST_INSERT_ID(); This will get you back the PRIMARY KEY value of the last row that *you* inserted: The ID that was generated is maintained in the server on a *per-connection basis*. 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*. So this is unaffected by other queries that might be running on the server from other users. S: http://stackoverflow.com/questions/17112852/get-the-new-record-primary-key-id-from-mysql-insert-query =============================================================================================== -- Silvio Clécio My public projects - github.com/silvioprog
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus