mysql - Do sqlite triggers work on the whole db or only the changed rows -
i need convert sqlite triggers mysql triggers. i've converted following sqlite trigger
create trigger arpinsert after insert on arp begin update arp set timeout = datetime('now', '60 seconds') rowid = new.rowid , new.mac != '00:00:00:00:00:00'; update arp set timeout = datetime('now') rowid = new.rowid , new.mac = '00:00:00:00:00:00'; end;
into following mysql trigger
delimiter // create trigger arpbeforeinsert before insert on arp each row begin if new.mac != '00:00:00:00:00:00' set new.timeout = date_add(now(), interval 60 second); else set new.timeout = now(); end if; end;// delimiter ;
i know mysql trigger triggers on effected rows. same true sqlite trigger? if removed where rowid = new.rowid
sqlite trigger update on whole table?
the sqlite documentation says:
at time sqlite supports each row triggers, not each statement triggers. hence explicitly specifying each row optional. each row implies sql statements specified in trigger may executed (depending on when clause) each database row being inserted, updated or deleted statement causing trigger fire.
however, applies trigger itself. sql statements inside trigger independent (and must if want access other tables/rows). therefore, executing update without clause update rows of table, same outside of trigger.
Comments
Post a Comment