Reputation: 1866
MySQL Verion: v5.0.95
Basically I have clients trying to get data - each client should only get unique rows.
START TRANSACTION;
SELECT id where result='new';
UPDATE SET result='old' WHERE id=$id;
COMMIT;
LOCK IN SHARED MODE
on the select statement still lets other clients read the data, which seems like a problem.
Basically I need the data selected once, updated, and not read again by another client.
Upvotes: 2
Views: 791
Reputation: 26699
SELECT FOR UPDATE
will block another read, while LOCK IN SHARED MODE
will allow the read, but won't allow update from another client
Upvotes: 5