Subject Re: [firebird-support] Firebird Event Names
Author Martijn Tonies
> > > >In a before update, insert, delete trigger
> > > >it is possible to do
> > > >POST EVENT new.field_name
> > > >to post an event with the data contained in the field.
> > >
> > > No; events don't carry any data. They are merely named signals.
> >
> > Not entirely true. There are systems that register for dynamic
> > events. For example, imagine a server side process (stored
> > procedure) that takes a few minutes to finish.
> >
> > An application can fire off a thread that starts the procedure
> > with an application defined parameter (eg: event_id) and
> > register an event "FINISH_MY_PROC_9988332" where
> > "9988332" is the event ID.
> >
> > When the procedure is finished, it could raise event (as written
> > in the documentation) like this:
> >
> > myval = 'FINISH_MY_PROC_' || EventID;
> > POST_EVENT myval;
> >
> > and the application could respond to the user with "bla bla
> > has finished" and un-register interest in the one-time-only
> > event.
> >
> > With regards,
> >
> > Martijn Tonies
>
> I do this this with threads but I don't need events... the thread finishes
> and posts a message to my main app thread...., my app knows anyway that
the
> proc has finished. Have I missed something?

No. It's just another way of doing things and I just gave an example
of dynamic event registering.

Depending on what you want, of course, you can even have other
applications register for dynamic events.

Think of, for example, an application that prints out invoices, running
on the/a server. It registers interest in invoices being prepared in a table
(eg: table "invoices_ready", column "invoiceid"). An after insert trigger
fires an event "new invoice ready". Next, the application checks the
table and registers interest in "invoice_ready_<invoiceid>". Whenever
someone prepares the invoice for printing (just an example), then
the server-side application could print the invoice.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com