Doing a very simple SELECT query and I'm not sure whats going wrong. It works fine when I do the WHERE statement pointing at one of the columns other than the primary key (weight). But as soon as I try and do a SELECT on the primary key the query hangs. Also this SELECT query works fine from the MySQL Administration program but always hangs through perl.
my $query_submitted = "SELECT * FROM rates WHERE weight = 2"; # Hangs
my $query_submitted = "SELECT * FROM rates WHERE zone2 = '4.67'"; # Wo
+rks fine
Here is the table information from a
"DESCRIBE rates";
Field |
Type |
Null |
Key |
Default |
Extra |
weight |
int(11) |
NO |
PRI |
|
auto_increment |
zone2 |
varchar(45) |
NO |
|
|
|
I've tried using placeholders, placing quotes around the number, leaving quotes out. It always seems to just hang. Any thoughts on what I'm missing here?
my $weight = 4;
my $query_submitted = 'SELECT * FROM rates WHERE weight = ?';
# This executes the query
my $sth_submitted = $dbh->prepare($query_submitted) or die "Error prep
+are";
$sth_submitted->execute($weight) or die 'Error';
Any help is appreciated. As always, thank you in advance.
EDIT: This is also on a Windows Server 2003 box. FYI.
UPDATE: Gave up. Switched to an ODBC connection and it works like intended...