Does MySQL prevent updates from occurring when the values involved are the 
same as the database's current state.

For instance, if I've got a table

create table updater(
id int not null primary key auto_increment,
is_active int not null default 1
};

insert into updater(is_active) values (1);
insert into updater(is_active) values (1);

update updater set is_active = 1;

Would MySQL essentially disregard this update statement b/c the values 
contained within the table are already 1?
Now, I realize that the values wouldn't be altered, but does the dB
do pre-checking and see which (if any) rows would be affected by the query, 
and only run the update against rows that would be changed?

There seems to be some reporting that is displayed which indicates that 
MySQL DOES indeed to "pre-checking"

mysql> select * from updater;
+----+-----------+
| id | is_active |
+----+-----------+
|  1 |         1 |
|  2 |         1 |
+----+-----------+
2 rows in set (0.00 sec)

mysql> update updater set is_active = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2  Changed: 0  Warnings: 0

mysql>

any thoughts?

thanks,
Paul



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to