a guest Jun 24th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN;
  2. do all the work for a single action
  3. COMMIT;
  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;
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand