Hi Pierce, Yes, I already knew about this problem and documentation. That's why I do it in a transaction. My question was about be unsure my code example do it correctly in Pharo.
Thanks Hilaire Le 20/07/2016 21:09, Pierce Ng a écrit : > On Sat, Jul 16, 2016 at 02:19:37PM +0800, Hilaire wrote: >> > In a multi-thread context use of Sqlite, I try to find out how one will >> > fetch securely the automatically last row index of a Primary key. >> > >> > The problem seems to be that between the insert of rows in a table and >> > the moment you request the last row id, you may have another insert from >> > another thread in the same database. > Hi Hilaire, > > See http://www.sqlite.org/c3ref/last_insert_rowid.html, especially > last paragraph: > > If a separate thread performs a new INSERT on the same database connection > while the sqlite3_last_insert_rowid() function is running and thus changes > the > last insert rowid, then the value returned by sqlite3_last_insert_rowid() is > unpredictable and might not equal either the old or the new last insert > rowid. > > Pierce > > -- Dr. Geo http://drgeo.eu