Subject Re: [firebird-support] MON$STATEMENTS - IBO vs IBexpert
Author Dmitry Yemanov
tomjanczkadao wrote:
>
> CREATE OR ALTER TRIGGER MY_TABLE_BD0 FOR MY_TABLE
> ACTIVE BEFORE DELETE POSITION 0
> AS
> declare variable temp_sql varchar(10000);
> begin
> /* there can be more than one active stmt */
> for select longc(STMT.MON$SQL_TEXT)
> from MON$STATEMENTS STMT
> where STMT.MON$ATTACHMENT_ID = current_connection
> and STMT.MON$STATE = 1

This approach is wrong by design. The monitoring snapshots are created
upon the first reference and cached until the transaction ends. So the
information will never be updated between trigger calls inside the same
transaction. Things get especially unpredictable if some other code
could also query the monitoring tables in the same transaction...


Dmitry