Subject Re: [firebird-support]using parameters with EVENT firebird 2.5+
Author Mark Rotteveel
On 2019-09-20 12:16, Rustam rustam-m@... [firebird-support] wrote:
> I am also looking for somthing like that. Typical task - inform
> clients about changes in some records: client need an record ID.
>
>> It's hardly compatible with the existing events architecture and
>> API, so
>> I'm still somewhat sceptical about its implementation.
>>
>> Dmitry
>
> I don't now API details, but my idea: what if we can specify 'mask' in
> Event name on clients, e.g. "ORDER_CHANGED*"?
>
>>
>
> Then client subscribes to event "ORDER_CHANGED*", and his code receive
> all events, who name is starting with "ORDER_CHANGED".
>
> On DB side in trigger we can fire event like that:
>
> POST_EVENT('ORDER_CHANGED' || new.ID)
>
> In client's code he get an actual event name, like '
> ORDER_CHANGED9999'. Then he can parse received string as he need.

You could try and use Firebird 3's RDB$RECORD_VERSION to check what
changed. However that approach has its flaws, because it is possible
that 'older' record versions will appear when an 'older' transaction is
committed after a 'newer' transaction with a higher transaction id, and
depending on how you use the record version pseudo-column, you might
miss those records.

Mark