To update database schema to reflect changed trigger procedures, change value of the field:
_file-trig._trig-crc This technique can be useful when there are multiple database trigger procedures that use include files. Modifying the include files will impact the CRC check on multiple triggers.
To avoid having to go through the whole database schema using the data dictionary and re-saving all the triggers manually, the following code example can be used:
DEFINE BUFFER ftbuf FOR _file-trig.
DEFINE VARIABLE savevnt LIKE _file-trig._event.
REPEAT PRESELECT EACH _file-trig WHERE _file-trig._trig-crc NE ?:
FIND NEXT _file-trig.
DISPLAY "Compiling:" _file-trig._proc-name.
COMPILE VALUE(_file-trig._proc-name) SAVE NO-ERROR.
IF NOT COMPILER:ERROR THEN DO:
RCODE-INFO:FILE-NAME = _proc-name.
CREATE ftbuf.
ASSIGN ftbuf._proc-name = _file-trig._proc-name
ftbuf._file-recid = _file-trig._file-recid
savevnt = _file-trig._event
ftbuf._override = _file-trig._override
ftbuf._trig-crc = RCODE-INFO:CRC-VALUE.
DELETE _file-trig.
ASSIGN ftbuf._event = savevnt.
END.
ELSE MESSAGE "Couldn't compile:" _file-trig._proc-name.
END.
* * * WARNING * * *Modifying the metaschema without using the provided Data Dictionary/Data Administration tools is potentially dangerous. Always make sure that there is a valid backup of the database before doing so.