Subject Re: FB 2.1 - new DB trigger feature with MON$ tables
Author Paul R. Gardner
Dmitry Yemanov wrote:
> Are you sure your connectivity layer doesn't release all statement
> handles when you issue a rollback?

I don't believe that to be the case. I've tried transactions in
IBExpert, as well as my application which is a Delphi application using
the FIBPlus components.

Thomas Steinmaurer wrote:
> The ON TRANSACTION ROLLBACK trigger feature is ready for prime time
when
> Firebird supports autonomous transactions in PSQL, because if a
ROLLBACK
> happens, the INSERT INTO statement in the trigger gets rollbacked as
well.

Good point, I hadn't thought of that. Actually, for testing, I did the
same thing for COMMIT as follows:

CREATE TRIGGER DATALOGGER
ACTIVE ON TRANSACTION COMMIT POSITION 0
AS
BEGIN
INSERT INTO GOODSQL(SQLTIME, SQLCMD)
SELECT CURRENT_TIMESTAMP, M.MON$SQL_TEXT
FROM MON$STATEMENTS M
WHERE M.MON$TRANSACTION_ID = CURRENT_TRANSACTION;
END

This never inserts anything either. When I view the MON$STATEMENTS
table before my application commits or does a rollback, I can see the
SQL in question. The TRANSACTION_ID field is always null. It's null
for all statements listed EXCEPT the one that IBExpert generated to view
that table (select * from MON$STATEMENTS).


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