ON CONFLICT Rollback algorithm in SQLite
Why we use Rollback algorithm in ON CONFLICT clause when Abort algorithm also work same.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Nov 30, 2011, 4:20 AM
hi monika ,
see, there is difference between both because
when we use Rollback, and conflict occure then it ROLLBACKs current transaction
but when we use ABORT,and conflict occure then it rollbacks changes of current sql statment not transaction.
so ABORT undo changes of current sql statement and
ROLLBACk undo changes of current transaction
Thanks,
Pravin.
Monika AroraPosted Dec 1, 2011, 4:06 AM
Pravin MorePosted Dec 1, 2011, 3:11 AM
before starting transaction you have code is 1
then you start transaction and in that
1st you update id to 6
2nd you try to update to NULL and conflict occure so rollback will undo code to 1.(it was before start of transaction)
thats the concept.
if you are not geting result like this then please check transaction
i am assuming that you are going to put 2 update in same transaction i.e update to 6 and update to null.
Thanks,
Pravin.
Monika AroraPosted Dec 1, 2011, 2:35 AM
Monika AroraPosted Nov 30, 2011, 5:29 AM