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 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  With Locals and Statics:

  A limitation imposed by the macro compiler in Clipper prevents Mach SIx
  from using LOCAL and STATIC variables.

  As you may have noticed from perusing the Mach SIx header files (MACHSIX.CH
  and MACHSIX2.CH),  Mach SIx functions receive both character and block
  forms of the FOR condition for all optimizable commands.  Since there is no
  way to internally de-compile a code block, Mach SIx evaluates queries
  solely from the string copy of the FOR condition.

  Each condition in the query is evaluated separately; indexed conditions
  first, non-indexed second.  The problem becomes evident when a string
  containing LOCALs or STATICs is macro compiled from deep within the Mach
  SIx code and those variables are no longer in scope.  (The code block form
  of the condition is only used when Mach SIx cannot optimize the expression
  and control is transferred to Clipper.)

  You can work around this limitation by manually creating a string condition
  and calling the desired optimizable command with the condition as an
  extended expression.  The following are several examples using character,
  number, and date query conditions.

     #include "DBFSIX2.ch"
     #include "MACHSIX2.ch"

     LOCAL cState, nAge, dDate, cCond1, cCond2, cCond3, nCount

     //............................................ STATE = 'CA'
     cState := 'CA'
     cCond1 := "STATE=='" + cState + "'"
     COUNT TO nCount FOR ( cCond1 )
     ? "Poof!"
     ? nCount

     //............................................... AGE < 30
     nAge = 30
     cCond2 := 'AGE < ' + alltrim( str ( nAge ) )
     COUNT TO nCount FOR ( cCond2 )
     ? "Poof!"
     ? nCount

     //............................. HIREDATE = ctod('04/01/93')
     dDate = ctod("04/01/93")
     cCond3 := "HireDate = ctod('" + dtoc( dDate ) + "')"
     COUNT TO nCount FOR ( cCond3 )
     ? "Poof!"
     ? nCount

     //............................STATE == 'CA' .AND.  AGE < 30
     COUNT TO nCount FOR ( cCond1 + " .AND. " + cCond2 )
     ? "Poof!"
     ? nCount



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