Andy Ford wrote:
I have a perl cgi script that needs to lock the tables. Unfortunately,
as HTTP is a one shot protocol, once the cgi script completes execution,
the tables are unlocked.

I need it to stay locked until another cgi script unlocks them!

Is there any other way of achieving this!?

You cannot unlock tables that have been locked by another cgi script. If you could, you could easily steal the locks that were set by someone else (not a good idea).


If your scripts access the tables exclusively, that is, no scripts from someone else or other clients have access to the tables you want to lock, you could use the GET_LOCK(str,timeout) and RELEASE_LOCK(str) functions to perform cooperative advisory locking on a global/server (not table) level. This will protect you from yourself, but requires consistent use by all your scripts and it doesn't protect you from other clients/scripts accessing the tables, something which you can easily forget sooner or later.

Hans-Peter


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to