Maybe is faster to swap the commands: 1. Select. If found done. 2. Insert (not doing ignore to get an error if it fails) and then get the rowid from sqlite3_last_insert_rowid.
Patrik On 01/04/2013 11:18 AM, Simon Slavin wrote: > > On 4 Jan 2013, at 9:55am, Krzysztof <dib...@wp.pl> wrote: > >> When I use INSERT OR IGNORE, if insertion fail (record exists), >> then sqlite3_last_insert_rowid does return nothing. Is exists similar >> solution which: >> 1. If insert success then return new rowid >> 2. If insert fail (record exists) then return rowid of existing record > > No. You are correct about how it works. The best solution is to do the > INSERT OR IGNORE as you're doing it already, then to use a SELECT to find the > rowid. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users