I have a bunch of mysql statements (that work on one MyIsam table only) in my PHP script and I don't want to execute these statements concurrently at any time, regardless of how many connections are being used.
For example, two different clients execute the php script on my server and the script opens one mysql connection per each request. I want first to execute the entire bunch of statements in the 1st request and only when this is completed, to execute the bunch of statements in the 2nd request.
I tried:
using "START TRANSACTION" before the bunch of statements => the table is MyIsam and must stay so, so this has no effect.
using "LOCK TABLE t WRITE" before the bunch of statements => locks are not maintained across connections so this doesn't work.
Thanks for help.
LOCK TABLE
does not work? It has to be maintained across connections otherwise it would be totally meaningless. If one connection locks the table for writes, others cannot write to it and will wait - but it won't forbid selects.LOCK TABLES
not TABLE - dev.mysql.com/doc/refman/5.5/en/lock-tables.html I did not notice it too first time..