Is there a simple way of knowing whether an 'insert' or a 'replace' occured when doing an 'INSERT OR REPLACE' query in SQLite3?
- You can check the ID of the row (in case you have such). When inserting it is empty and assigned from the SQLite engine, but for updating it should be full before the query runs. Unfortunately I have no so much details about how your DB is built or what you have at query time.Samuelens– Samuelens2014-05-11 07:38:12 +00:00Commented May 11, 2014 at 7:38
- Thanks. If the database did have a row ID, what is the format of the query to check the row ID?Alex– Alex2014-05-12 06:57:59 +00:00Commented May 12, 2014 at 6:57
Add a comment |
1 Answer
A yes/no answer would not suffice because it is possible to insert multiple records with one statement.
Functions such as sqlite3_changes do not count changes due to REPLACE constraints.
So this is not possible.
1 Comment
Alex
I had looked at that page, and that was my conclusion, but not being experienced with SQLite I wanted to make sure. Thanks very much.