3 ms·
I hope they build this in a way that returns the correct changed row count. Currently upserts in sqlite are a bit complicated because there is no feedback
by Grollicus 8y ago
I hope they build this in a way that returns the correct changed row count. Currently upserts in sqlite are a bit complicated because there is no feedback
- Apocryphon 8y agoAgreed that it should return the updated count automatically, but it's possible to get that amount by pairing it with a query for the rowid of that new record: https://www.sqlite.org/c3ref/last_insert_rowid.html https://www.sqlite.org/c3ref/last_insert_rowid.html And if it's a table with autoincrement primary key, try: https://stackoverflow.com/a/2217015/223327 https://stackoverflow.com/a/2217015/223327
- coleifer 8y agoFrom a quick test SQLite seems to be doing the right thing. I tested inserting single rows, multiple rows, and restricting the conflict-resolution with a WHERE clause -- the "row count" always came out correct.