Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : INDEX-INFORMATION attribute
 

INDEX-INFORMATION attribute

A character string consisting of a comma-separated list of the index or indexes the query uses at the level of join specified.
Data type: CHARACTER
Access: Read-only
Applies to: Query object handle

Syntax

INDEX-INFORMATION ( n )
n
An integer expression that evaluates to the level of join for which you want index information.
If the index or indexes do not have bracketing, the first entry in the list is the CHARACTER string "WHOLE-INDEX," and the second entry in the list is name of the index.
Before you use INDEX-INFORMATION on a dynamic query, you must prepare the query using the QUERY-PREPARE method.
Before you can use the INDEX-INFORMATION attribute on a static query, you must define the query using the DEFINE QUERY statement's RCODE-INFORMATION option.
The following example prints out the PREPARE-STRING, analyzes the INDEX-INFORMATION, and prints a list of bracketed and whole-index indexes:
r-iinfo.p
DEFINE VARIABLE hQuery AS HANDLE  NO-UNDO.
DEFINE VARIABLE ix     AS INTEGER NO-UNDO.
DEFINE VARIABLE jx     AS INTEGER NO-UNDO.

DEFINE QUERY q FOR Customer, Order, OrderLine SCROLLING.

hQuery = QUERY q:HANDLE.
hQuery:QUERY-PREPARE("FOR EACH Customer WHERE Customer.CustNum < 3,
 EACH Order OF Customer, EACH OrderLine").
hQuery:QUERY-OPEN.

MESSAGE "prepare string is" hQuery:PREPARE-STRING.

REPEAT ix = 1 TO hQuery:NUM-BUFFERS:
 jx = LOOKUP("WHOLE-INDEX", hQuery:INDEX-INFORMATION(ix)).
 IF jx > 0 THEN
   MESSAGE "inefficient index" ENTRY(jx + 1, hQuery:INDEX-INFORMATION(ix)).
 ELSE
   MESSAGE "bracketed index use of" hQuery:INDEX-INFORMATION(ix).
END.