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

UPDATE:

I just re-installed 5.8.0 and installed DBI 1.42 and the latest MySQL driver - and now it works. Grrrrr.....

In reply to DBI w/ mysql on Perl 5.8.3 by jmnewton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.