List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 20 1999 5:52pm
Subject:Re: Detecting when an update found a row but changed no data.
View as plain text  
On Mon, 1999-09-20 10:16:34 -0700, Scott Hess wrote:
> The problem is, the above snippet has a subtle failure mode.  If the
> values I'm setting equal the values that currently exist, then the
> UPDATE will return that 0 rows were affected.  There doesn't seem to
> be a reasonable way to determine this case, short of parsing the
> results of mysql_info().  Is there any way to get the number of
> matched rows from the UPDATE, even if they weren't modified?

As you seem to be using the C API, this might help:

  mysql_real_connect() takes a client_flag!

One of the possible flag bits is:
  Flag name          Flag meaning 
  CLIENT_FOUND_ROWS  Return the number of found rows, not the number
                     of affected rows CLIENT_NO_SCHEMA

I've never tested this myself ...

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Detecting when an update found a row but changed no data.Scott Hess20 Sep
  • Re: Detecting when an update found a row but changed no data.Martin Ramsch20 Sep
  • Re: Detecting when an update found a row but changed no data.Viren Jain20 Sep
    • Re: Detecting when an update found a row but changed no data.Scott Hess20 Sep
      • Re: Detecting when an update found a row but changed no data.Viren Jain20 Sep
      • Re: Detecting when an update found a row but changed no data.gl321 Sep
    • Re: Detecting when an update found a row but changed no data.(James Briggs)21 Sep
      • Re: Detecting when an update found a row but changed no data.Michael Widenius22 Sep
    • Re: Detecting when an update found a row but changed no data.Scott Hess22 Sep
      • Re: Detecting when an update found a row but changed no data.Michael Widenius22 Sep
    • Re: Detecting when an update found a row but changed no data.(James Briggs)22 Sep
    • Re: Detecting when an update found a row but changed no data.Scott Hess22 Sep
      • Re: Detecting when an update found a row but changed no data.Michael Widenius22 Sep
    • Re: Detecting when an update found a row but changed no data.Scott Hess23 Sep
      • Re: Detecting when an update found a row but changed no data.Martin Ramsch23 Sep
    • Re: Detecting when an update found a row but changed no data.Scott Hess23 Sep
      • Re: Detecting when an update found a row but changed no data.Martin Ramsch23 Sep
        • Re: Detecting when an update found a row but changed no data.Michael Widenius23 Sep
          • Re: Detecting when an update found a row but changed no data.gl323 Sep