As an example, with this script;
mysql_query("LOCK TABLES mytest WRITE;");
for ($i = 1; $i < 100000; ++$i) {
mysql_query("INSERT INTO mytest (Value, Value2, Value3) VALUES ($i, $i, $i);");
}
mysql_query("UNLOCK TABLES;");
What would happen if the script timed out / the users computer crashed / whatever before the UNLOCK TABLES stage is reached? Will mysql “notice” the client requesting the lock has disconnected and release the lock appropriately, or will it be stuck infinitively?
According to the MySQL docs: