I want to use advisory locks in MySQL.  The functuion is GET_LOCK(), and 
the way it should be used is SELECT GET_LOCK().  It return 1 is successful, 
0 if timed out, and undef on error.  The sequence:

my $db_lock = 'GET_LOCK("mylock", 5)';
my $result = $dbh->do($db_lock);

returns "1" regardless of whether the lock was obtained.  According to the 
cheetah book (Programming the Perl DBI), page 120/1, that's correct.  The 
$dbh->do statement only returns "0" on an error.

How do I execute the MySQL GET_LOCK function and get back the real result 
(0 or 1).  Always getting back a 1 as if I got the lock, whether I did or 
not, kind of defeats the purpose.

What is the work-around?

Thanks,
Rob

       _ _ _ _           _    _ _ _ _ _
      /\_\_\_\_\        /\_\ /\_\_\_\_\_\
     /\/_/_/_/_/       /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
    /\/_/__\/_/ __    /\/_/    /\/_/          PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_/    /\/_/
  /\/_/ \/_/  /\/_/_/\/_/    /\/_/         (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/     \/_/              appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]

Reply via email to