Subject | Re: [firebird-support] Re: FireBird Events |
---|---|
Author | unordained |
Post date | 2005-07-18T22:00:52Z |
Our application does something similar, except we didn't think to use fb events. We should have. We
wrote our own messaging server program, and send messages ourselves (from the client) when anything
changes.
But the logic is the same, so a few suggestions:
a) You might want to queue events on the client, and only refresh a maximum of, say, once a second.
We have some cases where several messages are all sent at once that would all cause certain
listviews to refresh. We didn't want flickering.
b) Consider by-foreign-key searches. Most of our listviews are things like "show condition codes
attached to this visit" -- so we only register an interest in the conditions.visit_fk field,
basically. In those cases, you'll want triggers to send something like "condition_visit_47" that
you can watch for -- and you'll only be registering interest in one event (for that listview). I
suppose you could just watch for "visit_47" and have triggers send that ... but we wanted to
distinguish between "the visit has changed" and "a condition attached to the visit has changed".
(Our record screens also refresh, if the record itself changes. The two events are distinct.)
Just some general suggestions ... but for whoever was making screens refresh -- thank you! I've
seen so many applications not refresh data on screen when they should ... it's depressing.
-Philip
---------- Original Message -----------
From: "colinriley666" <colin.riley@...>
To: firebird-support@yahoogroups.com
Sent: Mon, 18 Jul 2005 08:49:49 -0000
Subject: [firebird-support] Re: FireBird Events
wrote our own messaging server program, and send messages ourselves (from the client) when anything
changes.
But the logic is the same, so a few suggestions:
a) You might want to queue events on the client, and only refresh a maximum of, say, once a second.
We have some cases where several messages are all sent at once that would all cause certain
listviews to refresh. We didn't want flickering.
b) Consider by-foreign-key searches. Most of our listviews are things like "show condition codes
attached to this visit" -- so we only register an interest in the conditions.visit_fk field,
basically. In those cases, you'll want triggers to send something like "condition_visit_47" that
you can watch for -- and you'll only be registering interest in one event (for that listview). I
suppose you could just watch for "visit_47" and have triggers send that ... but we wanted to
distinguish between "the visit has changed" and "a condition attached to the visit has changed".
(Our record screens also refresh, if the record itself changes. The two events are distinct.)
Just some general suggestions ... but for whoever was making screens refresh -- thank you! I've
seen so many applications not refresh data on screen when they should ... it's depressing.
-Philip
---------- Original Message -----------
From: "colinriley666" <colin.riley@...>
To: firebird-support@yahoogroups.com
Sent: Mon, 18 Jul 2005 08:49:49 -0000
Subject: [firebird-support] Re: FireBird Events
> My application has an identical requirement (for quantity in stock). I------- End of Original Message -------
> achieve it as follows:
> The after_update trigger posts event "STOCK" || stock_id.
>
> Each client registers interest in its products. There is one instance
> of class TFFDStock for each product I'm intersted in:
>
> constructor TFFDStock.Create(...);
> begin
> inherited;
> fIBEvent := TSIBfibEventAlerter.Create(nil);
> with fIBEvent do begin
> Database := dmMain.dbEvents;
> OnEventAlert := EventAlert;
> Name := 'STOCK' + Id;
> Events.Add(name);
> Registered := True;
> end;
> end;
>
> When stock changes, this method is invoked:
>
> procedure TFFDStock.EventAlert(Sender: TObject; EventName: String;
> EventCount: Integer);
> begin
> dataset.Refresh;
> end;
>
> regards, Colin
>
> --- In firebird-support@yahoogroups.com, "sasidhardoc"
> <madhusasidhar@n...> wrote:
> > I want to use POST_EVENT in my database to monitor changes in a
> table.
> > Suppose I have a Table with fields STOCK_ID (generator value) and
> > STOCK_PRICE. I want my application to respond when the stock price is
> > changed. I intend to do this with a POST_EVENT inside an UPDATE
> Trigger.
> > But, if my application is only viewing a few stocks, then, the
> > application should be able to discern if the POST_EVENT was raised by
> > a change in STOCK_PRICE of the stocks it is viewing. My question is,
> > how do I inform the application as to which record was modified? I
> > suspect I could do this using
> > POST_EVENT event;
> > where event variable = STOCK_ID
> > However, my database has several tables with _ID fields that I want
> to
> > monitor and the generator values may be identical.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>