In my terms 'transaction' handles operations as atomic, say if one fail means all will fail. But what happens when the transaction's commit will fail for some reason?
Consider this:
How is this exactly work?
A.2,3 will be performed and if one of them fail, all changes will be reverted from the DB because the lack of 4? In this case if executions of 2,3 were ok but 4 failed, then the whole operation which should succeed will actually fail?
or
B.2,3 wont be performed on db level and if everythings is ok, then 4. will execute the actual commands in the DB? In this case if 4 fail at halfway of its operation for some reason means that partial -non-atomic- inserts will happen?
or
C.the answer is something different?
thanks!
The changes will be made in DB only if all steps are successful and the transaction commit happens successfully too (in your example, the step 4). It’s all or nothing.
Take a look on ACID transaction properties.