Salesforce

How to update database schema to reflect changed trigger procedures programatically

« Go Back

Information

 
TitleHow to update database schema to reflect changed trigger procedures programatically
URL NameP2939
Article Number000140922
EnvironmentProduct: Progress
Version: 9.x
Product: OpenEdge
Version: All supported versions
OS: All supported platforms
Question/Problem Description
How to change _FILE-TRIG._TRIG-CRC using 4GL ?
How to update database schema to reflect changed trigger procedures without using Data Dictionary ?
How to update CRC value on  _FILE-TRIG.
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
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.
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:37 AM

Powered by