Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Advantage CA-Clipper Guide v5.5 - set optimize http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SET OPTIMIZE
 Enable or disable automatic Client Advantage Optimized Filter optimization
------------------------------------------------------------------------------

 Syntax

     SET OPTIMIZE ON | off

     ON sets the automatic optimization of commands supported by Client
     Advantage Optimized Filters.  This is the default.

     OFF disables Client Adavantage Optimized Filters and defaults to
     standard CA-Clipper processing.

 Description

     The SET OPTIMIZE command is used to disable automatic optimization of
     all commands supported by Advantage Optimized Filters.  This command
     is useful when you want to compare your application's performance
     with and without the Client Advantage Optimized Filters.  You can
     also turn off optimization for selected commands by specifying the
     NOOPTIMIZE clause in the syntax for any command.

     Note:  SET OPTIMIZE is a Client Advantage Optimized Filter command.
     The command is only available if you link the Client Advantage Optimized
     Filter library, AOF.LIB, into your application and you #include the
     AOF.CH header file in your source code.

 Example

     // Must include AOF.CH in your source code to make the SET OPTIMIZE
     //   command available.
     #include "AOF.CH"

     LOCAL nCount, nStart, nTime

     USE account VIA "DBFCDXAX"

     // Assume index has single field key expression
     SET INDEX TO state

     // Set order to 0 for optimal Client AOF build performance
     SET ORDER TO 0

     // Turn off automatic Client AOF optimization
     SET OPTIMIZE OFF

     nStart := seconds()
     COUNT TO nCount FOR state = "ID"
     nTime := seconds() - nStart

     ? "Using the non-optimized method:"
     ? "Time to count   = " + alltrim( str( nTime ) )
     ? "Records counted = " + alltrim( str( nCount ) )

     // Re-activate Client Advantage Optimized Filters
     SET OPTIMIZE ON

     nStart := seconds()
     COUNT TO nCount FOR state = "ID"
     nTime := seconds() - nStart

     ? "Compare with the optimized method:"
     ? "Time to count   = " + alltrim( str( nTime ) )
     ? "Records counted = " + alltrim( str( nCount ) )


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson