1. - $500 from account A
2. + $500 to account B
Step 1 processes successfully, but something bad happens between step 1 and 2. Where is your money now -- you just lost $500!! This is clearly not acceptable, we need to be able to confidently say that steps 1 and 2 must all process successfully, or none of it can process at all.
Enter the concept of transactions. With transactions, we would be able to do this:
1. BEGIN TRANSACTION
2. - $500 from account A
3. + $500 to account B
4. END TRANSACTION
Now steps 1 to 4 are treated as one atomic operation. If anything fails between steps 1 to 4, the entire operation is aborted and we revert back to the way things were before we started. The worst that can happen here is that the money doesn't get transferred, but at least you will not lose $500.
Thank you for reading this article Transactions example With URL http://x-tutorials.blogspot.com/2005/04/transactions-example.html. Also a time to read the other articles.


0 comments:
Write your comment for this article Transactions example above!