Kbase P2622: Example code to retrieve the Database Schema (fields and ind
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2003 |
|
Status: Unverified
GOAL:
Example code to retrieve the Database Schema (fields and indexes of a table)
GOAL:
how to get the table and field information of the DB through 4GL
GOAL:
Using metaschema tables.
FIX:
/**The following code shows the fields and indexes of a table in a Database**/
DEFINE BUTTON a LABEL "SEARCH".
DEFINE BUTTON b LABEL "Exit".
DEFINE VARIABLE tableName AS CHAR VIEW-AS FILL-IN.
DEFINE FRAME c
tableName SKIP(2) a SPACE(4) b
WITH SIZE-CHARS 30 BY 7 SIDE-LABELS CENTERED TITLE "DataBase Schema".
ON CHOOSE OF a IN FRAME c
DO:
/*This part display the table info*/
ASSIGN tableName.
FIND FIRST _file WHERE _file-name= tableName.
DISPLAY _file-name.
FOR EACH _field OF _file:
DISPLAY _field._field-name.
END.
/*This part display the index info*/
FOR EACH _index OF _FILE,
EACH _index-field OF _index,
EACH _field OF _index-field.
DISPLAY _index-Name FORMAT "X(15)" _num-comp
_Wordidx _field-name FORMAT "X(15)".
END.
RETURN.
END.
ON 'enter':U OF tableName
DO:
APPLY 'CHOOSE' TO a IN FRAME c.
RETURN.
END.
ENABLE ALL WITH FRAME c.
WAIT-FOR CHOOSE OF b.