Subject | RE: [firebird-support] Retrieve name of table inside trigger |
---|---|
Author | Alan McDonald |
Post date | 2009-12-26T18:50:35Z |
>hard coding the only way. The ReplManager code at www.meta.com.au can give
> I want to log changes in certain tables to a change_log table inside
> the same
> database and the SP logic, etc is no problem, but..and it seems this
> must be
> obvious, but how can I determine the name of the table that a running
> trigger
> applies to? I didn't see anything in the context variables available
> in 2.1,
> but I could have missed it too.
>
> Right now I'm just hard coding the trigger name to an SP call that logs
> the
> changes, but it would be cleaner I think if I could
>
> Thanks,
>
> --
> Warm Regards,
>
> Lee
>
you some ideas on managing the installation of the triggers, i.e. querying
system tables for a list of tables for you to shoose from, but the trigger
code itself is hard coded witht th etable name
e.g.
IF( USER <> 'REPL' ) THEN
BEGIN
INSERT INTO CHANGES(TABLEKEY,TABLENAME,OP,LOC_ID)
SELECT NEW.ID,'ASSETS','I',LOC_ID
FROM REPL_TABLES WHERE TABLENAME='ASSETS';
END
Alan