Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN;
- SELECT stuff ... FOR UPDATE;
- fetches `stuff` and prevents (via a lock) other connections from messing with row(s).
- work with `stuff`.
- UPDATE the rows SELECTed (or a subset of them)
- COMMIT;
- (autocommit=1)
- UPDATE Queue... WHERE ... LIMIT... -- Grab row for self
- SELECT ... WHERE ... -- Make sure I got it, and fetch id
- if got it -- Perhaps someone else got it
- then
- BEGIN;
- work on application things
- COMMIT;
- endif
- DELETE FROM Queue WHERE ... -- remove from queue
Add Comment
Please, Sign In to add comment