Subject | RE: [firebird-support] Re: FB 2.1 - new DB trigger feature with MON$ tables |
---|---|
Author | Leyne, Sean |
Post date | 2008-04-10T16:12:14Z |
> > CREATE TRIGGER DATALOGGERIt is less rather than more.
> > 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).
>
> This is more or less as designed. Statement's
> MON$TRANSACTION_ID is not null only when the statement is
> active (i.e. running or being fetched from). As soon as the
> statement execution is terminated (e.g. upon exception), it's
> no longer bound to a particular transaction.
If the transaction context is 'lost' then what is the purpose of
allowing Transaction triggers???
Sean