Hi all.
New to Perl and new to DBI, though not new to scripting and databases in
general.
My script hangs when I try to add a WHERE clause to the SQL. This code works
fine :
 my $sql;
$sql = "SELECT * FROM images order by file_number limit 20";
$dbh = DBI->connect($dsn, $user, $password) or die ($DBI::errstr);
$sth = $dbh->prepare($sql) or die $DBI::errstr;
$dbh->{RaiseError} = 1;
$rv = $sth->execute;

If I put a where in the SQL, the script hangs indefinitely.
my $sql;
$sql = "SELECT * FROM images WHERE file_number = 1000002";
$dbh = DBI->connect($dsn, $user, $password) or die ($DBI::errstr);
$sth = $dbh->prepare($sql) or die $DBI::errstr;
$dbh->{RaiseError} = 1;
$rv = $sth->execute;
The SQL in the second block runs fine in my MySQL query window.
Not sure what's going on. Can I not pass an actual value into the prepare
statement? Do I have to use a placeholder? Any light shed appreciated ....
as the gardener said ;-)

Mark

Reply via email to