http://www.perlmonks.org?node_id=593684


in reply to Implementing rowlocking

Hi oyse,

Using autocommit or not is irrelevant in your present situation as it would not prevent the the lock row from being inserted in another transaction at the same time.

What you really nead is to LOCK your lock table:
mysql> LOCK TABLE locks WRITE; mysql> SELECT * FROM locks where yourcond=true; mysql> INSERT locks (...) VALUES(...); mysql> UNLOCK TABLES;
Some notes: