Mark - I don't understand why you'd say this is a recipe for disaster. I'm exactly trying to avoid a disaster by using locks and transactions. Here's why:
I have 3 tables "a, b, and c". I have a series of operations that must be perfoemed against each of them and together as an atomic unit of work. That's a "transaction".
It's also important that no other sql routines, that happen to be running at the same time, are modifying tables "a, b, or c". That would cause a problem.
That's why I think my sql commands must fire in this order:
START TRANSACTION
LOCK TABLES a WRITE, b WRITE, c WRITE;
(some sql queries appear here)
COMMIT;
UNLOCK TABLES;
How could I possibly have a situation where something bad happens? It would seem to me that these instructions would exclusively block out other concurrent threads from accessing tables "a, b, and c" while my transaction runs. No matter if the transaction fails or succeeds, at the conclusion, it should be business as normal because I run the UNLOCK TABLES command.
Is there something here I don't understand?
Jon