Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>sx_setturbo():</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Sx_SetTurbo():

  Syntax:   Sx_SetTurbo([lTurboRead])

            lTurboRead = Logical value indicating whether or not to
                         allow "dirty" index reads

  Returns:  Logical value indicating the current "dirty read" setting.

  Description:   This function sets/returns the "dirty read" setting for
                 the SIx Driver.  Setting "dirty read" to .T. allows
                 your application to read through index locks on a shared
                 index.

                 CAUTION: This is an advanced feature and should be used
                 with caution!  If dirty reads are done on an index that
                 is updated by other users, then there is no guarantee
                 that the index will be correctly positioned.

                 This function is used by the following commands:

                     SET TURBOREAD ON
                     SET TURBOREAD OFF

    NOTE:  This function is NOT supported under SIXNTX.

  Example:

    /*
        This program demonstrates the speed difference TURBOREAD makes when
        skipping though a shared database.
    */

    #include "SIXCDX.CH"

    LOCAL nStart, nEnd

    SET EXCLUSIVE OFF         // Make shared the default

    USE TEST VIA "SIXCDX"     // Open up the TEST database
    INDEX ON last TO last     // Build an index; Since it's exclusive after
    CLOSE DATA                //  just creating it, close the database and
    USE TEST VIA "SIXCDX"     //  reopen it
    SET INDEX TO LAST         // Then set our index active again

    ? "Skip test - shared"
    ?
    nStart := Seconds()            // Save starting time
    FOR nCnt := 1 TO 240           // Cruise through the database for a bit
      ?? "."                       // Print a dot
      DO WHILE !eof()              // Skip to the end of the file
        SKIP
      ENDDO
      DO WHILE !bof()              // Skip back to the beginning of the file
        SKIP -1
      ENDDO
    NEXT
    nEnd := Seconds()              // Save ending time

    ? "Elapsed time:", nEnd - nStart, "seconds"
    ?

    // Now turn dirty read on
    Sx_SetTurbo(.T.)

    ? "Skip test - shared with dirty read on"
    ?
    nStart := Seconds()            // Save starting time
    FOR nCnt := 1 TO 240           // Cruise through the database for a bit
      ?? "!"                       // Print an exclamation point
      DO WHILE !eof()              // Skip to the end of the file
        SKIP
      ENDDO
      DO WHILE !bof()              // Skip back to the beginning of the file
        SKIP -1
      ENDDO
    NEXT
    nEnd := Seconds()              // Save ending time

    ? "Elapsed time:", nEnd - nStart, "seconds"



See Also: SET TURBOREAD What is TURBOREAD?

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