Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mach SIx v1.1c - Reference Guide - <b>set optimize - toggle automatic optimization on/off</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SET OPTIMIZE     - Toggle automatic optimization on/off
-------------------------------------------------------------------------------

  Syntax:

  SET OPTIMIZE ON/OFF/<lExp>

  Arguments:

  ON sets automatic optimzation of Mach SIx supported commands.  This
  is the default.

  OFF overrides automatic optimization and defaults to standard
  Clipper processing.

  <xlToggle> is a logical expression that must be enclosed in parentheses.
  A value of true (.T.) is the same as ON, and a value of false (.F.) is
  the same as OFF.

  Description:

  The SET OPTIMIZE command is used to disable automatic optimization of all
  Mach SIx supported commands.  This command is useful when you wan't compare
  your applications query performance with and without Mach SIx.  You can
  also turn off optimization for selected commands by specifying the
  NOOPTIMIZE clause in the syntax for the command.

  ---------------------------------| EXAMPLE |--------------------------------
  /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  *  Demonstrates the SET OPTIMIZE command.                                 *
  *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/

  #include "DBFSIX.CH"
  #include "MACHSIX.CH"

  Local nCount, nStart, nTime

  USE Account VIA "DBFSIX"

  SET INDEX TO State       //  State could be a tag in a .CDX

  ? "Example of SET OPTIMIZE command."
  ?

  //..........................set order to 0 for optimal query performance
  SET ORDER TO 0

  //.......................................turn off automatic optimization
  SET OPTIMIZE OFF

  nStart := seconds()
  COUNT TO nCount FOR State = "CA"
  nTime  := seconds() - nStart

  ? "Whoah that was slow!"
  ? "Time to count   = " + alltrim( str( nTime ) )
  ? "Records counted = " + alltrim( str( nCount ) )

  //....................................re-activate Mach SIx optimization
  SET OPTIMIZE ON

  nStart := seconds()
  COUNT TO nCount FOR State = "CA"
  nTime  := seconds() - nStart

  ? "Poof!"
  ? "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