Consultor Eletrônico



Kbase P115619: How to determine whether or not a procedure needs to be recompiled after a database change in OpenEd
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/27/2006
Status: Unverified

GOAL:

How to determine whether or not a procedure needs to be recompiled after a database change

GOAL:

How to determine that a .R program will not have a CRC error when ran against a database

GOAL:

How to compare the R-Code CRC against the table CRCs

FACT(s) (Environment):

OpenEdge 10.x

FIX:

In order to determine if a R-Code file will not have a CRC error, use the TABLE-CRC-LIST attribute with TABLE-LIST attribute of the RCODE-INFO system handle.
This allows to compare the CRC value for all tables referenced in the R-Code file with those stored in the database.

For example, the code below allows to display a list of referenced tables, and their CRC values, in the R file and the CRC value of those tables in the database.

DEFINE VARIABLE cTemp AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE cTableList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCRCList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFileList AS CHARACTER NO-UNDO.
DEFINE TEMP-TABLE ttTableCRC NO-UNDO
FIELD cNAME AS CHARACTER FORMAT "X(20)" /* Table name*/
FIELD iCRC AS INTEGER FORMAT ">>>>>>9 " /* Table's CRC value */
.
/* R file to check */
RCODE-INFO:FILE-NAME = "C:\work\prog.r".
/* Retrieve table list as well as their CRC values */
ASSIGN
cTableList = RCODE-INFO:TABLE-LIST
cCRCList = RCODE-INFO:TABLE-CRC-LIST
.
/* Store tables referenced in the .R file into the Temp-Table */
REPEAT i = 1 TO NUM-ENTRIES(cTableList):
cTemp = ENTRY(i,cTableList).
/* Warning: Table-List also returns the database name */
/* SUBSTRING removes the database name */
CREATE ttTableCRC.
ASSIGN
ttTableCRC.cName = SUBSTRING(cTemp,LENGTH(DBNAME) + 2,length(cTemp) - LENGTH(DBNAME))
ttTableCRC.iCRC = INTEGER(ENTRY(i,cCRCList))
.
END.
/* Display the table CRC value stored in the .R file */
/* and the table CRC value in the datbase */
FOR EACH ttTableCRC:
FIND FIRST _file WHERE _file._file-name = ttTableCRC.cName NO-LOCK.

DISP tttableCRC.cName LABEL "Table Name"
ttTableCRC.iCRC LABEL "[.R] Table CRC"
_file._CRC LABEL "[DB] Table CRC"
.
END.