Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN;
- a bunch of UPDATEs to subtract money from one place and add it to another.
- if overdrawn, ROLLBACK
- else COMMIT
- BEGIN;
- SELECT ... FOR UPDATE; -- the rows you need to look at and may need to update
- ... (tests)
- UPDATE ... -- subtract money from here
- UPDATE ... -- add that money to there
- COMMIT;
Add Comment
Please, Sign In to add comment