Is there a way to lock table entries in SQL/MySQL? I'm looking for something like this (in php, but it should not matter):
Pseudo-Code:
waitForTableEntryWithKey("somekey");
lockTableEntryWithKey("somekey");
doSomethingWithSQL();
unlockTableEntryWithKey("somekey");
doSomethingWithSQL()
must not be executed more than one time at a time for a certain table entry. Is there a way to do this in SQL, except for creating a locked bool
in the table and querying it while waiting (it just seems like an improper solution)?