Tim Bunce wrote:
>
> Thanks.
>
> I'm thinking in terms of
>
> $h->{HandleEvent} = sub { ... }
>
> which would be called when the driver code calls something like
> DBIh_EVENT(...)
Will this also apply to async callback for event alerter?
InterBase and Firebird supports event alerter: an event can be posted
from inside a stored proc or a trigger, and an application may choose to
sync wait for the event, or alternatively register/install a callback.
Current DBD::InterBase in its cvs already has had support for this
feature, which is implemented by the means of private methods and
separate event objects (handles).
my $cb = sub {
++$cnt;
print "Event caught! Count: $cnt.\n";
};
# initialize an event handle, announcing interests of the occurences of
foo_inserted and foo_updated events
my $evh = $dbh->func('foo_inserted', 'foo_updated', 'init_event');
# register callbacks for $evh
$dbh->func($evh, $cb, 'register_callback');
init_event() only accepts max 15 event names, so if an application wants
to watch for more than 15 events, it must initialize another event
handle. And register_callback() should then be called again to the
subsequent eveht handles.
So the installed callback also depends on $evh, not only $dbh. In this
case, $h->{HandleEvent} seems insufficient. Maybe I'm wrong, so I'm open
to any suggestion.
--
rgds,
Edwin