Eric Smith <eas....@gmail.com> wrote: > The tcl interface spec says: > >> The "last_insert_rowid" method returns an integer which is the ROWID of >> the most recently inserted database row. > > So if I have > > db eval {CREATE TABLE t(the_key INTEGER PRIMARY KEY, data TEXT)} > > and I > > db eval {INSERT INTO t VALUES(NULL, 'foo')} > > then does > > db last_insert_rowid > > reliably return the_key of the most recently inserted database row, > so that the returned value may safely (across vacuums etc) be used > as a foreign reference to t's the_key column?
Yes. > Is this the best way of inserting a guaranteed non-conflicting row & > getting the new row's key? Yes. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users