List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:March 6 2001 11:37am
Subject:Re: mSQL: Number of rows affected never correctly returned
View as plain text  

Paul Hoepfner-Homme wrote:

> I now realize I was mistaken that $sth->rows() didn't return the number
> of rows on a SELECT -- it actually does work properly with SELECTs.  But
> it turns out that that's the one case where I don't even need it. :)  I
> need it for UPDATEs and DELETEs, and it reliably returns -1 for each of
> those queries in this script.

So this clarifies a lot.

$sth->rows is useless in the case of UPDATE and/or DELETE, if you
are using $dbh->do which you typically will do. Of course you may
use a sequence prepare, execute. In that case $sth->rows should work
as expected: In other words, it returns the value of msqlNumRows.

A simpler solution is using

	my $numRows = $dbh->do(...)


Does that work?
Thread
mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme3 Mar
  • Re: mSQL: Number of rows affected never correctly returnedJochen Wiedmann5 Mar
  • Re: mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme5 Mar
  • Re: mSQL: Number of rows affected never correctly returnedJochen Wiedmann5 Mar
  • Re: mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme5 Mar
  • Re: mSQL: Number of rows affected never correctly returnedJochen Wiedmann6 Mar
  • Re: mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme6 Mar
  • Re: mSQL: Number of rows affected never correctly returnedJochen Wiedmann6 Mar
  • Re: mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme6 Mar
  • Re: mSQL: Number of rows affected never correctly returnedPaul Hoepfner-Homme7 Mar
  • Re: mSQL: Number of rows affected never correctly returnedDodger9 Mar
  • Re: mSQL: Number of rows affected never correctly returnedJochen Wiedmann14 Mar