I'm not following why you need to force an update? You mentioned a row refresh, but I'm not sure in what context. If you are looking to find out if a row has changed since you last read it, then you should have a timestamp field. The first timestamp field is always updated when data changes in a record, so you could use this as sort of a record versioning system. Just query the timestamp field to check if the data has changed, if it has, then do the full query to retrieve the entire record.

Even if you create a field that you change on every update, MySQL only changes the data in fields that have changed, not in all the fields in your update statement. Paul DuBois she be able to correct if I'm wrong on this. I can't think of any reason to force a rewrite the same data to disk.


On Sep 20, 2004, at 3:49 PM, 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.

-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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]





--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to