jmnewton has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Perl 5.8.3 (freshly built), 1.42 DBI and 2.9003 (or whatever the latest is) of mySQL DBD. I can do updates fine, but whenever I try to do a select (1st prepare, 2nd execute, 3rd fetch*) - the fetch always barfs and says:
Undefined subroutine &DBD::mysql::st::fetchrow_array at ./test.pl line + 23
Here's my code:
use strict; use warnings; use DBI; our $bpsUser = <snip> our $bpsPwd = <snip> our $bpsHost = <snip> our $bpsConn = ""; $bpsConn = DBI->connect("DBI:mysql:database=BPS;host=$bpsHost", $bpsUser, $bpsPwd, {'RaiseError' => 1}); our $query = "SELECT timestamp FROM STATS ORDER BY timestamp ASC LIMIT 1"; our $result = $bpsConn->prepare($query); print $result->execute() . "\n"; our @ary = $result->fetchrow_array();
This is textbook simple - every DBI tutorial I've seen has given this kind of example. This was working great on 5.8.0 and DBI 1.32 and an earlier mysql driver. I am at a total loss to explain why this is not working now.
If I print out $result - I see that it is a DBI:st HASH - which is what it should be.
-j
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI w/ mysql on Perl 5.8.3
by jZed (Prior) on Mar 18, 2004 at 20:17 UTC | |
by jmnewton (Initiate) on Mar 18, 2004 at 20:45 UTC |