Subject Re: [firebird-support] FB 2.1 - new DB trigger feature with MON$ tables
Author Dmitry Yemanov
Paul R. Gardner wrote:

> In the application I support, SQL is dynamically created by the
> application. On extremely rare occasions, the SQL generated is bad and
> an exception is thrown. Since our users are never running in a
> programming environment, this can be a hard thing to duplicate and track
> down. I'd like to use the new DB trigger feature in conjunction with
> the new MON$ tables feature to help track these. In the application, a
> good transaction is committed, and an exception is rolled back. So I
> did the following:
>
> CREATE TRIGGER DATALOGGER
> ACTIVE ON TRANSACTION ROLLBACK POSITION 0
> AS
> BEGIN
> INSERT INTO BADSQL(SQLTIME, SQLCMD)
> SELECT CURRENT_TIMESTAMP, M.MON$SQL_TEXT
> FROM MON$STATEMENTS M
> WHERE M.MON$TRANSACTION_ID = CURRENT_TRANSACTION;
> END
>
> I figured this would allow me to check a user's database and find out
> why they reported an error. Unfortunately it never works.

Are you sure your connectivity layer doesn't release all statement
handles when you issue a rollback?


Dmitry