Subject | Re: [Firebird-Architect] Re: NOT UPDATABLE fields |
---|---|
Author | Ann W. Harrison |
Post date | 2005-02-25T17:01:03Z |
Roman Rokytskyy wrote:
get for extending the trigger syntax that we don't have already.
AS BEGIN
IF ((old.protectedCol1 IS DISTINCT FROM new.protectedCol1)
OR (old.protectedCol2 IS DISTINCT FROM new.protectedCol2))
THEN RAISE myException;
END
Regards,
Ann
>Unh, maybe I'm just having a really bad, day, but I don't see what we
>
> I think we can solve this problem easier if we extend our mechanism of
> trigger to accept <search condition> as part of the condition that
> fires the trigger (currently it contains only {BEFORE | AFTER} {INSERT
> | UPDATE | DELETE}, but if I'm not mistaken, SQL standard allows also
> WHEN <search condition> and REFERENCING old AS <local var name>
> clauses to trigger definition).
get for extending the trigger syntax that we don't have already.
>CREATE TRIGGER blah ON mytable AFTER UPDATE
> So the trigger can look like this:
>
> CREATE TRIGGER bla ON myTable AFTER UPDATE
> WHEN
> old.protectedCol1 IS DISTINCT FROM new.protectedCol1
> OR
> old.protectedCol2 IS DISTINCT FROM new.protectedCol2
> AS BEGIN
> RAISE myException;
> END
AS BEGIN
IF ((old.protectedCol1 IS DISTINCT FROM new.protectedCol1)
OR (old.protectedCol2 IS DISTINCT FROM new.protectedCol2))
THEN RAISE myException;
END
Regards,
Ann