Subject Re: createing and using events
Author Adam
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...> wrote:
> Hi all,
>
> Using Delphi 5, FB 1.5 (ss mode) and FIBPlus
>
> We have an app that has custom drop down lists that any user can
edit as
> required ie they can edit the contents of the drop down lists to suit
> there own needs.
>
> A problem has arisen in that when one user changes the contents of the
> drop down list the other users dont see the new list contents until
they
> re-log in to the database.

Well they wont see the changes until you commit your transaction and
they commit and start a new transaction.

>
> Now I know that I can resolve this using Firebird "events" but I am not
> sure how to go about this.
>

The syntax etc is well documented in the IB6 notes. The logic goes
something like this.

The client program registers interest in the event.
Inside the trigger of interest, you post that event.
As soon as your transaction commits, the client program is notified
The client program would then have to take actions to refetch its list.

> Could someone send me some details of how to do this from within a
SP as
> the event notification needs to go to all current users logged in
except
> the user that made the change.
>

That is a client side thing, it is a pretty trivial operation to
ignore the event if you have just done something that would have
caused it, but wouldn't even the program that made the change need to
refetch its list?

> Also will this cause any network traffic issues ?

Yes, particularily if all the client programs simultaneously refetch
large datasets.

There are also potentially firewall issues with events so we don't use
them for that sort of thing. We instead use triggers to add a record
to a notification table when an event of interest happens for the client.

The client periodically polls this table with a simple and inexpensive
select first 1 1 type query. This happens every minute in our system.
The dataset returned is a single integer field and a single record, so
over the wire traffic is trivial.

Adam