Nikolaus Rath <nikol...@rath.org> wrote: > How can I determine the rowid of the last insert if I am accessing the > db from different threads? If I understand correctly, > last_insert_rowid() won't work reliably in this case.
Last inserted rowid is maintained per connection. Do your threads use the same connection, or each create their own? If all threads share the same connection, it is your responsibility to make "insert then retrieve last rowid" an atomic operation, using thread synchronization mechanism of your choice. Just as with any access to shared data. > I can't believe that I really have to do a SELECT on the data that I > just INSERTed only to get the rowid... I'm not sure how this helps, if another thread can insert more data between your INSERT and SELECT. Wouldn't that suffer from the same problem? Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users