At 14:49 -0500 9/20/04, Jeff Demel wrote:
That's what I was afraid of.
Now I have to add a bunch of code to check the data before sending
(pull the record, compare the data, then decide to run the update or
not). How efficient is that, I wonder?
Is there any way to force it to update the row?
I'm thinking a workaround might be to add a TimesUpdated column as
an Int, and update that every time (TimesUpdated = TimesUpdated+1).
That would force a return value of 1.
First you should check your provider to find out if it offers some
way to set the connect flag that tells MySQL to return the rows-matched
value rather than the rows-changed value. If you can do this, the return
from an UPDATE will include rows matched by the WHERE clause, whether or
not the values actually changed.
-Jeff
Brent Baisley wrote:
No, MySQL will indicate if anything in the row has changed. If you
are updating with the same data, than nothing changes and MySQL
doesn't waste the time to lock the table, write the data and update
the indexes. It's much more efficient this way.
On Sep 20, 2004, at 3:22 PM, Jeff Demel wrote:
I'm seeing some odd behavior when I run an UPDATE query, and need
to know if this is something that MySQL does. It could be
something the MySQLDirect .NET provider is doing, and to cover
that possibility I've sent an email to their support team.
So anyway, here's the scenario.
If I run an UPDATE query, and my UPDATE statement contains the
same values that are already in the row, what should the return
value be? I'm occasionally sending the same exact data back to a
row to refresh it, and am getting 0 as a return value. If I send
different data, then I get a 1 back, which makes sense.
For example:
*Row values in ThisTable
ID(Int), Name(Text), Description(Text)
5,"thisname","thisdescription"
*SQL
UPDATE ThisTable Set
Name = 'thisname',
Description = 'thisdescription'
WHERE ID = 5;
So should this SQL statement return 0 or 1? I'm getting 0, but
really think I should be getting a 1. I would think that if there
was no ID with a value of 5, then it would return 0. But if there
is a row with an ID of 5, then it should refresh the row and
return 1. Right?
-Jeff
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]