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

Paul Hoepfner-Homme wrote:

> You say $sth->rows is useless in the case of UPDATE and/or DELETE.  You
> mean, msqlNumRows will only return the number of rows SELECTed, and will
> be undefined if the query wasn't a SELECT?  If so, is this just a
> limitation of the mSQL API?  I wonder if there is a way around it.

To quote the DBI man page:

       rows

             $rv = $sth->rows;

           Returns the number of rows affected by the last row
           affecting command, or -1 if the number of rows is not
           known or not available.

           Generally, you can only rely on a row count after a
           non-SELECT execute (for some specific operations like
           UPDATE and DELETE), or after fetching all the rows of
           a SELECT statement.

In other words: It may work with some drivers, it doesn't work
for all.
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