Re: DBI:mysql question

2000-07-12 Thread Rob Tanner
Thanks Dana and Chip. That did it! --On Wednesday, July 12, 2000 4:25 PM -0700 Dana Powers <[EMAIL PROTECTED]> wrote: > You'll need to use $sth = $dbh->prepare(...); and $sth->execute(); > Then ($lock) = $sth->fetchrow_array(); and $sth->finish(); > $dbh->do assumes that you are inserting or u

Re: [OT] DBI:mysql question

2000-07-12 Thread Ken Williams
[EMAIL PROTECTED] (Chip Turner) wrote: >A one-line example of this can be tested by running the following in >two shell windows: > >$ perl -MDBI -e 'my $dbh = DBI->connect("DBI:mysql:mysql", "yy", "xx"); > my $sth = $dbh->prepare("SELECT GET_LOCK(\"mysql\", 5)"); $sth->execute; > my ($lock) = $

Re: DBI:mysql question

2000-07-12 Thread Chip Turner
Rob Tanner <[EMAIL PROTECTED]> writes: > 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 $re

Re: DBI:mysql question

2000-07-12 Thread Dana Powers
You'll need to use $sth = $dbh->prepare(...); and $sth->execute(); Then ($lock) = $sth->fetchrow_array(); and $sth->finish(); $dbh->do assumes that you are inserting or updating and so you dont expect any results back. A GET_LOCK does not work like that, as you have noted, so you will need to trea

DBI:mysql question

2000-07-12 Thread Rob Tanner
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