Consultor Eletrônico



Kbase P104044: How to find which table holds which recid ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/1/2008
Status: Verified

GOAL:

How to find which table holds which recid ?

GOAL:

In version 8, how to find which table a recid belongs to ?

FACT(s) (Environment):

Progress 8.2x
Progress 8.3x
All Supported Operating Systems

FIX:

In Progress 8.x this is a bit clumsy as the VST's don't have a reference directly to the _file metaschema table. Thus one would check each table in the database for the recid.
Without dynamic queries however, one will have to rely on compile-time arguments to an external procedure, or generate a separate find by recid for each table.

The following two procedures form an example based on compile-time arguments.

/* tablefind.p */
/* Loop through tables */

define variable lFound as logical no-undo.
find first _lock where _lock-id <> ?.

for each _file:
/* pass table name as argument */
run checktable.p (INPUT _lock-recid, OUTPUT lFound) _file-name.

if lFound then do:
message _file-name view-as alert-box.
leave.
end.
end.

/* checktable.p */
/* this procedure is compiled on the fly and does a find by recid for a specific table */
define input parameter iRecid as recid.
define output parameter lFound as logical.

find {1} where recid({1}) = iRecid no-lock no-error.

lFound = available({1}).