On Oct 28, 2007, at 10:59 AM, Michael Ruck wrote:
Yes, I am well aware of this possibility as I've written in my
initial mail.
It just doesn't fit with the
description of sqlite3_last_insert_rowid() in my understanding. I
think this
is a bug - either in the documentation
or in the implementation. sqlite3_last_insert_rowid() should return
the
correct id, no matter what and it doesn't.
Consider this scenario:
CREATE TABLE ex1(id INTEGER PRIMARY KEY, b UNIQUE, c UNIQUE);
INSERT INTO ex1 VALUES(1,1,1);
INSERT INTO ex1 VALUES(2,2,2);
INSERT INTO ex1 VALUES(3,3,3);
Now you do your INSERT OR IGNORE:
INSERT OR IGNORE INTO ex1 VALUES(1,2,3);
Three different constraints fail, one for each of three different
rows. So if sqlite3_last_insert_rowid() were to operate as you
suggest and return the rowid of the failed insert, when rowid
would it return? 1, 2, or 3?
D. Richard Hipp
[EMAIL PROTECTED]
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------