List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 17 2001 1:16pm
Subject:Re: Why should not rely on $sth->rows() ?
View as plain text  
At 3:28 PM +0900 6/17/01, Batara Kesuma wrote:
>Hi all,
>I read in DuBois's MySQL, Perl DBI API Reference part, it is written:
>$rv = $sth->rows();
>Return the number of rows affected by the statement associated with $sth
>or -1 if an error occured. This method is used primarily for statements
>that do not return rows. For SELECT statements, you should not rely on the
>rows() method; count the rows as you fetch them instead.
>My question is, why we should not rely on $sth->rows()? Does it mean that
>it doesn't match sometime? Anybody ever experienced?

It's not guaranteed to work.  It's not portable.
In practice, it seems to work fine for MySQL. The warning is there
so that you can't blame DBI if you rely on rows() and one day find that
it fails. :-)

>Also, in the case of "ERROR 1114: The table 'SQL22e0b00_0' is full". I
>found that this function returned -2 instead of -1.

Paul DuBois, paul@stripped
Why should not rely on $sth->rows() ?Batara Kesuma17 Jun
  • Re: Why should not rely on $sth->rows() ?Paul DuBois17 Jun