Can there be any possible ways to make use of an "after update" trigger only within the situation the information continues to be REALLY transformed. I understand of "NEW and OLD". However when with them I am only in a position to compare posts. For instance "NEW.count <> OLD.count".
However I want something similar to: run trigger if "NEW <> OLD"
A Good Example:
create table foo (a INT, b INT); create table bar (a INT, b INT); INSERT INTO foo VALUES(1,1); INSERT INTO foo VALUES(2,2); INSERT INTO foo VALUES(3,3); CREATE TRIGGER ins_sum AFTER UPDATE ON foo FOR EACH ROW INSERT INTO bar VALUES(NEW.a, NEW.b); UPDATE foo SET b = 3 WHERE a=3; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 select * from bar; +------+------+ | a | b | +------+------+ | 3 | 3 | +------+------+
The thing is, there is an update, but nothing has transformed. However the trigger went anyway. IMHO there must be a means it does not.
I understand which i might have used
IF NOW.b <> OLD.b
BUT make a large table with altering posts. You need to compare every column and when the database changes you need to adjust the trigger. Also it does not "feel" good to check every column from the row hardcoded :)
As you can tell at risk
Rows matched up: 1 Transformed: Alerts:
MySQL recognizes that the road did not change. However it does not share this understanding using the trigger. A trigger like "AFTER REAL UPDATE" or something like that like this is awesome.
BUT make a large table with altering posts. You need to compare every column and when the database changes you need to adjust the trigger. Also it does not "feel" good to check every row hardcoded :)
Yeah, but that is the best way to proceed.
Like a side note, it is also sound practice to pre-emptively check before upgrading:
UPDATE foo SET b = 3 WHERE a=3 and b <> 3;
Inside your example this could allow it to be update (and therefore overwrite) two rows rather than three.