Subject | FB 2.1 - new DB trigger feature with MON$ tables |
---|---|
Author | Paul R. Gardner |
Post date | 2008-04-09T16:24:17Z |
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. The
MON$TRANSACTION_ID is always null.
Is this possible to do?
Thanks in advance,
Paul
[Non-text portions of this message have been removed]
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. The
MON$TRANSACTION_ID is always null.
Is this possible to do?
Thanks in advance,
Paul
[Non-text portions of this message have been removed]