Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. BEGIN;
  2. do all the work for a single action
  3. COMMIT;
  4.  
  5. BEGIN;
  6. if not enough funds, ROLLBACK and exit
  7. UPDATE to take money from one account
  8. UPDATE to add that money to another account
  9. INSERT into some log or audit trail to track all transactions
  10. COMMIT;
  11.  
  12. BEGIN;
  13. SELECT some stuff from a row FOR UPDATE;
  14. test the stuff, such as account balance
  15. UPDATE that same row;
  16. COMMIT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement