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 - ax_getaofoptlevel() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_GetAOFOptLevel()
 Returns the optimization level of the current active Server Advantage
 Optimized Filter
------------------------------------------------------------------------------

 Syntax

     AX_GetAOFOptLevel( [<cNonOptExpr>] ) -> numeric

     <cNonOptExpr>  Optional character expression containing the
     non-optimized portion of the current active Server Advantage Optimized
     Filter.  If the Server AOF is fully optimized, an empty string will be
     returned.  Note that this is an output parameter.  Therefore, if this
     parameter is passed, it must be passed by reference.

 Returns

     Returns ADS_OPTIMIZED_FULL (1), ADS_OPTIMIZED_PART (2), or
     ADS_OPTIMIZED_NONE (3).  If the operation was unsuccessful, 0 is
     returned, and AX_Error() will return information on why the operation
     failed.

 Description

     AX_GetAOFOptLevel() returns the optimization level of the currently
     active Server Advantage Optimized Filter.  A Server Advantage Optimized
     Filter is created via the AX_SetServerAOF() API.

     The optimization for Server AOFs can be one of three levels.  Server
     AOFs can be fully optimized (ADS_OPTIMIZED_FULL = 1), partially
     optimized (ADS_OPTIMIZED_PART = 2), or not optimized
     (ADS_OPTIMIZED_NONE = 3).  For example, the filter expression
     "lastname == 'Smith' .AND. firstname == 'John'" will be fully
     optimized (ADS_OPTIMIZED_FULL) if indexes exist on "lastname" and
     "firstname".  If an index exists on only one of those fields, then
     the filter will be partially optimized (ADS_OPTIMIZED_PART).  If no
     index exists for either field, then the filter will not be optimized
     (ADS_OPTIMIZED_NONE).

     If the currently active Server AOF is partially optimized or
     non-optimized, the non-optimized portion of the filter expression
     will be returned in the cNonOptExpr output parameter.

     Note:  Filtering deleted records (SET DELETED ON) without an index
     built on "DELETED()" will have no effect on the optimization level.
     In other words, if the rest of the expression is fully optimized then
     the optimization level returned via AX_GetAOFOptLevel() will still be
     fully optimized. In this case, AX_GetAOFRecordCount() returns the
     number of records including the deleted records. To remove deleted
     records from AX_GetAOFRecordCount(), there must be an index built
     on "DELETED()".

     Note:  Filters created on tables opened with the DBFNTXAX RDD will
     not be optimized.  Only filters created on tables opened by the
     DBFCDXAX RDD will be optimized.

 Example

     USE Accounts INDEX state VIA "DBFCDXAX"

     // Create a partially optimized AOF on the server.
     AX_SetServerAOF( "state == 'CA' .and. lastname > 'Smith'" )

     // Get the optimization level of the AOF that was just created.
     //   Note: cNonOptExpr must be passed by reference.
     nOptLevel := AX_GetAOFOptLevel( @cNonOptExpr )

     // This should display a 2 for the optimization level
     ? "The optimization level is: ", nOptLevel

     // This should display "lastname > 'Smith'" for the non-optimized expr.
     ? "The non-optimized part of the filter expression is: ", cNonOptExpr


See Also: AX_SetServerAOF() AX_GetAOFExpr() AX_GetAOFRecordCount()

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