How to Lock a Table - MySql
Posted on 2007-10-08
I have a table called 'matrix' in mysql. I am subtracting 10 from a field called 'dollarsGained'. To accomplish this, I will use the following code:
LOCK TABLES matrix WRITE;
UPDATE matrix SET dollarsGained = dollarsGained - 10;
I am having trouble with the locking portion of this code and would like the answers to the following questions:
1) After executing the statement ' LOCK TABLES matrix WRITE;' how do I check that the table is actually locked?
2) How do I just unlock the table 'matix' without unlocking all of the tables in the database?
3) How do I check that the table is actually unlocked?
MySQL 5.0.45-community-nt via TCP/IP
MySQL Client Version 5.1.11