SQLite Forum

how can i identify the data is just inserted into the database or updated the existed item when i use upsert-clause
Login
The update hooks work but I think it's easier to update first and if there was nothing updated to insert. You can check the update by the last changed rowid which can be reseted to -1 before you update or by RETURNING. If you use the update hook you have to filter the table or activate or deactivate it around the CALL. RETURNING is working with non rowid tables which the upate hook is not. I used the update hook but RETURNING is in my view much simpler.