MySQL Forums :: Perl :: perl script hangs on query with where clause


Advanced Search

perl script hangs on query with where clause
Posted by: Johan De Graeve ()
Date: December 05, 2008 07:02PM

Hi,

Can somebody tell me why the second query in this script hangs.
The first query is a simple query without a where clause.
The second one is a query on the same table with a simple where clause.

Tried this on Activestate 5.10.0 distribution (ActivePerl-5.10.0.1004-MSWin32-x86-287188.msi)and Camelbox 5.10.0 distribution (camelbox_2008.304.0742Z-odin.exe)

Mysql = 5.0.51b

Thx

use strict;
use warnings;
use DBI;

my $database="mde";
my $hostname="localhost";
my $dsn = "dbi:mysqlPP:database=$database;host=$hostname";
my $user="root";
my $password="neptunus";
my $sth;

my $dbh = DBI->connect($dsn, $user, $password, {'RaiseError' => 1});
my $drh = DBI->install_driver("mysqlPP");
print "Drop table test...";
$sth = $dbh->do(qq{drop table test});
print "done\n\n";

print "create table test...";
$sth = $dbh->do(qq{
create table test (
v1 int auto_increment primary key
, v2 varchar(10)
, v3 varchar(10)
, v4 varchar(10)
, v5 varchar(10)
)
});
print "done\n\n";

print "Inserting row...";
$dbh->do(qq{insert test(v2,v3,v4,v5) values("a", "b", "c", "d")});
print "done\n\n";

print "The next statement works fine...\n";
print "Executing: select v2 from test...";
$sth = $dbh->prepare("select v1 from test");
$sth->execute();
my @row = $sth->fetchrow_array;
$sth->finish;
print "done\n\n";

print "The next statement will hang...\n";
print "Executing: select v2 from test where v1=1\n";
$sth = $dbh->prepare("select v2 from test where v1=1");
$sth->execute();
print "select with where clause hangs. You will never see this message\n";
$sth->finish;

$dbh->disconnect;

Options: ReplyQuote


Subject Written By Posted
perl script hangs on query with where clause Johan De Graeve 12/05/2008 07:02PM
Re: perl script hangs on query with where clause Ryan Lowe 12/06/2008 10:26PM
Re: perl script hangs on query with where clause eric preece 01/03/2009 12:25AM
Re: perl script hangs on query with where clause Kelly Jones 01/15/2009 10:35AM
Re: perl script hangs on query with where clause Vinayak Javaly 01/16/2009 09:00AM
Re: perl script hangs on query with where clause - RESOLVED Vinayak Javaly 01/16/2009 11:29AM
Re: perl script hangs on query with where clause - RESOLVED Vinayak Javaly 01/18/2009 11:16AM
Re: perl script hangs on query with where clause - RESOLVED Justin Izzard 02/26/2009 08:45AM
Re: perl script hangs on query with where clause - RESOLVED Vinayak Javaly 02/26/2009 11:30AM
Re: perl script hangs on query with where clause - RESOLVED Justin Izzard 03/17/2009 11:52AM
Re: perl script hangs on query with where clause - repo add typo Kelly Jones 04/20/2009 09:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.