Subject Re: [firebird-support] Action on disconnect
Author Jonathan Neve
Helen Borrie wrote:

>>I've asked this on the Interbase newsgroup, and they say it's not
>>possible. Can this be done with FireBird? If not, wouldn't this be a
>>useful (and simple) thing to implement?
>>
>>
>
>I don't know. What would be trapped? Who or what would trap it? What
>would the purpose be?
>
Well, it would open a door of new possibilities. For example, I have an
application in which I log all user connections and disconnections to
the database. The way I do it is insert a row into a log table when the
application starts up, and at shutdown, I update the record with the
disconnection time. My problem is that when a user's connection to the
database gets cut without the application having been closed properly
(for example if the application hangs, or if there's a network problem),
I have no way of updating the record, so it looks like the user is still
connected.

So it would be nice if there was a way to trap database events (such as
connection and disconnection) in a sort of trigger style. Something like:

CREATE TRIGGER ON_CONNECTION_LOST BEFORE (or AFTER) DISCONNECT
AS
BEGIN
......
END;

Perhaps there could also be a way to catch this event from a client
application, but this seems to me to be less useful.

Thanks!

Jonathan Neve.


[Non-text portions of this message have been removed]