Why DBI cannot lock mysql tables?
- From: "DBI newbie" <charles.sun@xxxxxxxxxx>
- Date: 13 Nov 2005 22:45:03 -0800
Can anyone help? I am stuck on it for days. My DBI cannot lock mysql
tables, even if the lock table command works well in mysql command
line.
My setup is: Redhat, MySQL 5.0.15, Perl 5.8.0, DBI 1.38, DBD::mysql
3.0002_3
Here is the simple Perl code replays the problem:
#!/usr/bin/perl -w
use strict;
use DBI;
print "-----------------Begin-------------------------\n";
my $dsn = "DBI:mysql:host=localhost;database=test;port=3306";
my $dbh = DBI->connect($dsn, 'dbuser01', 'i901na22',
{ RaiseError => 1,
PrintError => 1,
PrintWarn => 1,
ShowErrorStatement => 1,
TaintIn => 1,
FetchHashKeyName => 'NAME',
});
$dbh->{TraceLevel} = "1";
my $str;
$str = "LOCK TABLES t1 WRITE"; #This doesn't work.
#$str = "Insert t1 (name) values ('my');"; #This works.
my $_current_sth;
$_current_sth = $dbh->prepare($str); #BREAK HERE:
# returns undef when using LOCK TABLES
$_current_sth->execute();
$_current_sth = undef;
$dbh->disconnect;
$dbh = undef;
print "-----------------End-------------------------\n";
.
- Prev by Date: Re: Wish List
- Next by Date: Re: Why no [dbi-users] in subject
- Previous by thread: Why no [dbi-users] in subject
- Next by thread: error installing Bundle::DBD::mysql 3.0002
- Index(es):