Guest User

Untitled

a guest
Dec 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. BEGIN;
  2. a bunch of UPDATEs to subtract money from one place and add it to another.
  3. if overdrawn, ROLLBACK
  4. else COMMIT
  5.  
  6. BEGIN;
  7. SELECT ... FOR UPDATE; -- the rows you need to look at and may need to update
  8. ... (tests)
  9. UPDATE ... -- subtract money from here
  10. UPDATE ... -- add that money to there
  11. COMMIT;
Add Comment
Please, Sign In to add comment