Consultor Eletrônico



Kbase P2939: How to update database schema to reflect changed trigger procedures without using Data Dictionary ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/02/2011
Status: Verified

GOAL:

How to change _FILE-TRIG._TRIG-CRC using 4GL ?

GOAL:

How to update database schema to reflect changed trigger procedures without using Data Dictionary ?

GOAL:

How to update CRC value on _FILE-TRIG.

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

FIX:

This Solution describes how to change value of _file-trig._trig-crc field. This can be useful when there are multiple database trigger procedures using include files since modifying the include files will impact 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 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 * * *
Manually modifying the metaschema without using the provided Data Dictionary/Data Administration tools is potentially dangerous. Always make sure there is a valid backup of the database before doing so.