List:MySQL and Perl« Previous MessageNext Message »
From:Dan Busarow Date:May 28 1999 9:25pm
Subject:Re: Drivers giving different results
View as plain text  
On Tue, 25 May 1999, Jochen Wiedmann wrote:
> I recently had a discussion with some DBD::mysql users, in particular
> Tim Bunce the DBI maintainer, about the following:
> 
> If I do a
> 
> 	UPDATE foo SET col=col
> 
> then the MySQL optimizer detects that no work needs to be done, which
> is of course a good thing. The problem is that mysql_affected_rows
> seems to return the value 0, in other words the number of *physically*
> affected rows. This seems to break some peoples reliabiliy checks, which
> expects the number of rows being returned.
> 
> On the other hand the MySQL server obviously knows the number of matched
> rows:
> 
> 	mysql> update user set Host=Host;
> 	Query OK, 0 rows affected (0.00 sec)
> 	Rows matched: 11  Changed: 0  Warnings: 0
> 
> It seems this information is now returned by mysql_info(). (I didn't
> verify.)
> 
> I am now asked to change the DBD::mysql driver not to return the result
> of mysql_affected_rows(), but read mysql_info() and parse the output to
> return the matched rows. This is something I definitely don't like,
> because it is slow and unsafe.
> 
> My question is whether you can either
> 
>   - supply the same info via a new function, mysql_matched_rows(), say or
>   - change mysql_affected_rows to return the number of matched rows

Maybe mysql_affected_rows could be changed to look at the
return-found-rows option (settable via mysql_options) that
mysql_info uses?

Dan
-- 
 Dan Busarow                                                  949 443 4172
 Dana Point Communications, Inc.                            dan@stripped
 Dana Point, California  83 09 EF 59 E0 11 89 B4   8D 09 DB FD E1 DD 0C 82

Thread
Re: Drivers giving different resultsJochen Wiedmann25 May
  • Re: Drivers giving different resultsVivek Khera25 May
  • Re: Drivers giving different resultsTim Bunce26 May
  • Re: Drivers giving different resultsDan Busarow29 May
    • Re: Drivers giving different resultsJochen Wiedmann29 May
  • Re: Drivers giving different resultsMichael Widenius2 Jun
    • Re: Drivers giving different resultsTim Bunce2 Jun
      • Re: Drivers giving different resultsMichael Widenius3 Jun
        • Re: Drivers giving different resultsTim Bunce3 Jun
          • Re: Drivers giving different resultsMichael Widenius3 Jun
            • Re: Drivers giving different resultsTim Bunce3 Jun
Re: Drivers giving different resultsJochen Wiedmann26 May