Kbase P112558: 4GL/ABL: How to extract index usage information of a static, semi dynamic or dynamic query?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/12/2008 |
|
Status: Verified
GOAL:
4GL/ABL: How to extract index usage information of a static, semi dynamic or dynamic query?
GOAL:
How to get index usage information of a static 4GL/ABL query?
GOAL:
How to extract index usage information of a semi dynamic 4GL/ABL query?
GOAL:
How to extract index usage information of a dynamic 4GL/ABL query?
GOAL:
How to use the INDEX-INFORMATION query attribute?
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
FIX:
Use the INDEX-INFORMATION attribute of the query object handle. The following three 4GL code samples demonstrate how to access the INDEX-INFORMATION attribute of static, semi dynamic and dynamic queries:
1. Extract the index usage information of a static query:
/***************Define needed variables************/
DEFINE QUERY qQueryName FOR Customer.
DEFINE VARIABLE hQueryHandle AS HANDLE.
/* Set the static query handle and open it */
hQueryHandle = QUERY qQueryName:HANDLE.
OPEN QUERY qQueryName FOR EACH Customer BY name.
/* Extract the index usage information */
MESSAGE hQueryHandle:INDEX-INFORMATION
VIEW-AS ALERT-BOX INFO BUTTONS OK.
2. Extract the index usage information of a semi dynamic query:
/***************Define needed variables************/
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE hBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hQueryHandle AS HANDLE NO-UNDO.
/* Set the table name to be used in the semi dynamic query */
ASSIGN
cTableName = "Customer".
/* Define the Static query*/
DEFINE QUERY qQueryName FOR Customer.
/* Set the SemiDynamic query handle, prepare and open it */
hQueryHandle = QUERY qQueryName:HANDLE.
hQueryHandle:QUERY-PREPARE("for each " + cTableName + " NO-LOCK" + " BY NAME").
hQueryHandle:QUERY-OPEN.
/* Extract the index usage information */
MESSAGE hQueryHandle:INDEX-INFORMATION
VIEW-AS ALERT-BOX INFO BUTTONS OK.
3. Extract the index usage information of a dynamic query:
/***************Define needed variables************/
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE hBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hQueryHandle AS HANDLE NO-UNDO.
/* Set the table name of the dynamic query*/
ASSIGN
cTableName = "Customer".
/* Create, prepare and open the dynamic query */
CREATE BUFFER hBufferHandle FOR TABLE cTableName.
CREATE QUERY hQueryHandle.
hQueryHandle:SET-BUFFERS(hBufferHandle).
hQueryHandle:QUERY-PREPARE("for each " + cTableName + " NO-LOCK" + " BY NAME").
hQueryHandle:QUERY-OPEN.
/* Extract the index usage information */
MESSAGE hQueryHandle:INDEX-INFORMATION
VIEW-AS ALERT-BOX INFO BUTTONS OK.