Subject | Blank space after varchar trigger thinks equal to old value |
---|---|
Author | Mark Steinberg |
Post date | 2005-12-06T21:23:42Z |
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????
Mark
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????
Mark