List:MySQL and Perl« Previous MessageNext Message »
From:Tim Bunce Date:June 3 1999 2:15pm
Subject:Re: Drivers giving different results
View as plain text  
On Thu, Jun 03, 1999 at 04:28:16PM +0300, Michael Widenius wrote:
> 
> I can however understand that some applications may want to check
> the result from the above query (Thats why I added CLIENT_FOUND_ROWS
> in the first place).
> 
> On the other hand, I can also think of applications that really want
> to know if the status really did change (as this may indicate that
> some other client did change the status first).  This is actually VERY 
> useful and it's a pity that most other databases doesn't support this!

I can see that.

> Tim> Assuming it's made an option then the fix for the rare soul who
> Tim> actually wants a 'physically modified' count will be trivial.
> 
> I agree.

I hope Jochen does.

> Tim> Meanwhile, I'll leave you with this rather sad bit of code I found in
> Tim> the Catalog.pm support modules:
> 
> Tim> 	my $affected = $stmt->execute() or ...
> Tim> 	#
> Tim> 	# Return 1 if update occured at least on a row, even
> Tim> 	# if nothing was modified in that row.
> Tim> 	#
> Tim> 	$ret = 1 unless $affected == 0 and $stmt->{info} =~ /matched: 0 /;
> 
> I agree that the above is very sad!  It will only work if you are
> using MySQL with the English language file!
> 
> It should be:
> 
> $ret = 1 unless $affected == 0 and $stmt->{info} =~ /^[^:]: 0 /;

Almost right. I'll change it to /^[^:]+: 0 /  :-)

I think the arguments you've made for the utility of both kinds of
counts and the current need to deal with connect-time options and/or
parse strings to get them, suggests to me that both values should be
available as integers via API functions.

Tim.
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