Subject Re: [firebird-support] Blank space after varchar trigger thinks equal to old value
Author Thomas Steinmaurer
Hello Mark,

> In Firebrid 1.5 we are running iblog manager which has
> triggers set on each table to record changes to the
> database. It works great until we have a varchar
> field. When we add or take out a blank character the
> trigger will not work. The trigger thinks that the
> values have not changed. For example on a after update
> trigger
>
> IF (((OLD.CONTROLLICENSE IS NULL) AND
> (NEW.CONTROLLICENSE IS NOT NULL)) OR
> ((OLD.CONTROLLICENSE IS NOT NULL) AND
> (NEW.CONTROLLICENSE IS NULL)) OR (OLD.CONTROLLICENSE
> <> NEW.CONTROLLICENSE)) THEN
> INSERT INTO IBLM$COLUMNLOG (ID, OPERATIONLOG_ID,
> COLUMN_NAME, OLD_VALUE, NEW_VALUE, OLD_VALUE_BLOB,
> NEW_VALUE_BLOB)
> VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1),
> :VAR_ID, 'CONTROLLICENSE', OLD.CONTROLLICENSE,
> NEW.CONTROLLICENSE, NULL, NULL);
>
>
> the (OLD.CONTROLLICENSE <> NEW.CONTROLLICENSE)
> returns false when
> 'OLD' <> 'OLD '
>
> any ideas????

As Ann has mentioned, this behaves like it is defined in the SQL
standard. Using NOT LIKE works the way you would expect it. The change
in IBLM is easy, though not sure if it should be a user-setting for
either using <> or NOT LIKE.

Please mail me, if you are in a rush for a fixed version. Thanks.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com