Is it possible to use arguments with firebird events : POST_EVENT 'event_name' + string args? -


i've trigger detects change on field phone_ext , posts event. post phone_id event in order use id in client. possible? how?

create trigger tr2 employee active after update position 0 begin     if (new.phone_ext <> old.phone_ext)           post_event 'phone_ext_changed'; <-- pass string parameter record id end 

afaik, cannot pass parameters, can want 1 of ideas:

  • if in client you're interested in events on specific records, can append id of changing record , post event. clients register events in interested using specific id's of interest. see example 1.
  • if front-end interested in changes want know particular records changed, can "flag" records "recently changed" (using field on same record, or detail table, example). upon client notification , action reverts or clears flag. approach may powered, example, using auxiliary tables track missing records specific clients, depends on needs.

example 1

begin   if (new.phone_ext <> old.phone_ext)     post_event 'phone_ext_changed_'||new.id; end 

example 2

begin   if (new.phone_ext <> old.phone_ext)   begin     new.recent_ext_change = 1;     /* or maybe */     new.last_ext_change = cast('now' datetime);     /* or maybe */     insert changed_phone_ext values (gen_id(some_generator, 1), new.id, 'now');     /* finally, post event */     post_event 'phone_ext_changed_';   end end 

i'm using both success in different applications/situations.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -