Re: [firebird-support] Re: After update trigger: the same values for new.somefiled and old.somefield
> 29.08.2016 10:24, patrick_mar...@yahoo.com [firebird-support] wrote: >> Somehow I've thought that an after update trigger only fires once when all >> the changes >> have been made and comitted. >DML triggers are fired on every change of every record. And they fire BEFORE the **transaction** is committed (or rolled back). Commit - all changes take effect and become visible to other transactions Rollback - no changes take effect at all. HB
Re: [firebird-support] Re: After update trigger: the same values for new.somefiled and old.somefield
29.08.2016 10:24, patrick_mar...@yahoo.com [firebird-support] wrote: > Somehow I've thought that an after update trigger only fires once when all > the changes > have been made and comitted. DML triggers are fired on every change of every record. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
[firebird-support] Re: After update trigger: the same values for new.somefiled and old.somefield
Hi guys, thanks for the suggestions and ideas, it helped to track it down. It was not directly another trigger or procedure updating the record in question, but something similar : I had altered an existing trigger. There was an if-block checking a field A for being not null and executing some code. I'd placed the new code inside of this if-block as I was sure, that the field A can't be null at this point and if it is, the new code doesn't need to be executed anyway. This wasn't correct though, because I'm setting this field A in my application in the AfterPost event of the dataset. So what happened was: - first post (= after update trigger execution): my "somefield" (part of the new code) has actually changed, but the field A was still null -> no new code execution at all - second post (= after update trigger): field A was not null anymore, but also my "somefield" (part of the new code) had the same new value in the new. and old. variables already -> no new code execution for the old value Somehow I've thought that an after update trigger only fires once when all the changes have been made and comitted. Placing the new code outside of the existing if-block works fine now. Thank you all for the help!