Hi Hajime,

The event notification in FB (via client library API) uses two data 
structures (event blocks). One for event counts received so far and 
other for updated event counts. They are initialized by isc_event_block 
API call. Once the AST callback is registered via isc_que_events API 
call, your callback function receives and update block one needs to keep 
(typically copied over old one). To get the actual count of events, one 
needs to call isc_event_counts with both event blocks as parameters, 
which returns "flags" (actual counts since last one) for changed ones 
and copies updated one over "last" one to reset the counter. Important 
thing is, that AST callback is called immediately on first 
isc_que_events to initialize/reset the counters (i.e. when event block 
doesn't match the current update block).

So, pyfirebirdsql needs to do something similar internally.

best regards
Pavel Cisar
IBPhoenix


Dne 25.5.2012 03:24, Hajime Nakagami napsal(a):
>
> I have merged first event support codes to pyfirebridsql's master branch.
> https://github.com/nakagami/pyfirebirdsql
>
> Now it can recieve event notification.
> But It can't return correct count(flag ?)
>
> $ cd pyfirebirdsql/tests
> $ python tests_event.py
> ('dsn=', 'localhost/3050:/Users/nakagami/pyfirebirdsql/tests/test.fdb')
> HANDLER: An event notification has arrived:
> (2, {'event_b': 2, 'event_a': 3, 'event_d': 1})
>
> I hope it return
> {'event_b': 1, 'event_a': 1, 'event_d': 0} (like kinterbasdb)
> or
> {'event_b': 1, 'event_a': 2, 'event_d': 0}
>
> But I don't know that how to count event occured.
> Someone send pull request or patch to project, please

Reply via email to