Try OpenEdge Now
skip to main content
Debugging and Troubleshooting
Troubleshooting Resources : Log Entry Types Detail : Query information logging : Starting query information logging : Writing query statistics on-demand
 
Writing query statistics on-demand
You can write the currently accumulated query information logging statistics on a query to the log before the query completes, by calling the DUMP-LOGGING-NOW( ) method of the query object handle.
When you call DUMP-LOGGING-NOW( ) for a pre-pass query, OpenEdge writes the second set of statistics to the log. OpenEdge writes the first set after it builds the result-list. For more information, see Query statistics for pre-pass queries.
The DUMP-LOGGING-NOW( ) method returns TRUE if OpenEdge successfully writes the statistics to the log file; FALSE otherwise. Logging will fail, for example, if query information logging is turned off (for the individual query or in general), or if the query started before query information logging was turned on.
The syntax for the DUMP-LOGGING-NOW( ) method is:
query-handle:DUMP-LOGGING-NOW(reset)
The DUMP-LOGGING-NOW() method takes an optional logical argument that, if set to TRUE, resets the query’s statistics to zero after writing to the log. FALSE is the default. In either case, statistics continue to accumulate as the query completes.
The following example writes to the log file after each result and resets the accumulated values:
DEFINE VARIABLE qh AS HANDLE NO-UNDO.
CREATE QUERY qh.
qh:SET-BUFFERS(BUFFER customer:HANDLE).
qh:QUERY-PREPARE("FOR EACH customer WHERE customer.custnum < 5"). qh:QUERY-OPEN().
REPEAT:
qh:GET-NEXT().
IF qh:QUERY-OFF-END THEN LEAVE.
qh:DUMP-LOGGING-NOW(TRUE).
END.