Subject Re: [firebird-support] Newbee to events - how to know which record changed
Author Milan Babuskov
Jarrod Hollingworth wrote:
>> Applications that listen to events are meant to run all the time in
>> the background and "wake up" when event fires. Since they run all
>> the time, they can keep the state and know where they "left off".
>> For example, instead of querying all the tasks completed today, each
>> time you get the event and process it, save CUREENT_TIMESTAMP in
>> some local variable of the application. Next time event fires, just
>> query
>>
>> WHERE update_time > :last_time
>>
>> to get records that were updated since. This is one type of
>> application.
>
> Be aware that in a multi-user environment there are some difficulties and it
> is possible to miss some rows with this approach unless carefully
> implemented.

Jarrod, you are completely right. In fact, in real system, I don't use
timestamps, but BIGINT column filled with a generator. This way you
don't miss anything, even if the system date and time is changed on the
server (due to DST change for example).

Thanks for correction,

--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com