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 v6.11 - aofgetoptlevel() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 aofGetOptLevel()
 Get the optimization level of a Client Advantage Optimized Filter
------------------------------------------------------------------------------

Syntax

     aofGetOptLevel( [<nHandle>] ) -> numeric

     <nHandle>  Optional handle to an existing filter. If a handle is
     specified, then aofGetOptLevel() returns the optimization level of a
     user-owned filter. If no handle is passed, then aofGetOptLevel()
     returns the optimization level of the system-owned filter.

Returns

     Returns a  numeric result which is one of the following values:

     2:  Fully Optimizable
     1:  Partially Optimizable
     0:  Not Optimizable

Description

     aofGetOptLevel() returns the original optimization level of the
     system-owned filter or the specified user-owned filter.

     Three levels of optimization are possible (see examples below for
     more information):

        Fully Optimizable means that the filter condition was fully resolved
        by looking at the indexes (i.e., all records meeting the condition
        were determined solely by looking at the indexes).

        Partially Optimizable means that part of the filter condition was
        resolved by looking at indexes, but part of the condition could not
        be resolved.

        Not Optimizable means that no part of the condition could be resolved
        by looking at indexes.

     This function will always return the optimization level of the
     filter when it was created.  If a newly created filter is partially
     optimized, and is then converted to a fully optimized filter via the
     aofResolvePartial() function, aofGetOptLevel() will still return a
     value of 1, indicating that when the filter was created it was only
     partially optimizable.

     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 aofGetOptLevel() will still be
     fully optimized. In this case, aofCountRecords() returns the number of
     records including the deleted records. To remove deleted records from
     aofCountRecords(), there must be an index built on "DELETED()".

Example

     USE customer

     SET INDEX TO age, last

     nHandle1 := aofCreateFilter( "age > 30 .and. last = 'J'" )

     ? aofGetOptLevel( nHandle1 )  // Will return 2 (fully optimizable),
                                   // since the filter condition can be
                                   // fully resolved just by looking at
                                   // the indexes

     aofSetFilter( "last = 'S' .and. state = 'CA'" )

     ? aofGetOptLevel()            // Will return 1 (partially
                                   // optimizable), since only the
                                   // "last = 'S'" part of the filter
                                   // condition can be fully resolved
                                   // by looking at the indexes

     nHandle2 := aofCreateFilter( "first = 'B'" )

     ? aofGetOptLevel( nHandle2 )  // Will return 0 (not optimizable),
                                   // since no part of the filter
                                   // condition can be resolved just by
                                   // looking at the indexes

     // Free the two user-owned filters
     aofFreeFilter( nHandle1 )
     aofFreeFilter( nHandle2 )


See Also: aofCreateFilter() aofSetFilter()

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