Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>v_walk_dbv()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 V_WALK_DBV()
 Step from field to field in a DBV without a DBF.
-------------------------------------------------------------------------------

 Syntax

    V_WALK_DBV( [<cTopOfFile>], [<cAlias> | <nArea>] )  ->   cPointer

 Arguments

    <cTopOfFile> should be the word "First" (only the "F" is
    significant) to return the pointer to the first field in a DBV.  Any
    other value (including NIL) will tell V_WALK_DBV() to skip to the next
    field.

    <cAlias> or <nArea> is a DBV file alias or area specified with
    V_USE() or V_SELECT(). If omitted, the operation will occur in the
    current DBV area.

 Returns

    This function returns a pointer to the current VLF. (See discussion
    below).  The return value is a NULL string ("") when the end of file is
    reached or when an error is encountered in the DBV.

 Description

    V_WALK_DBF() is a disaster recovery function and should rarely if every
    be needed.  However, if you loose a DBF file and still want to recover
    the contents of the DBV, this function can be indispensible.

    When called for the first time or when <cTopOfFile> is given the
    value "first", V_WALK_DBV() will return a pointer to the first Variable
    Length Field in the DBV (this is the first physical field).  Any
    subsequent call to this function (where <cTopOfFile> is not
    "first"), V_WALK_DBV() will return a pointer to the next physical field
    in the DBV.

    Thus, when put in a loop, you can walk through every field in a DBV and
    retrieve a valid FlexFile pointer for use with V_RETRIEVE(),
    V_REPLACE(), etc.

 Examples

    LOCAL vlf_ptr, str := ""

    // Open the DBV without opening a DBF.
    V_USE( "lost_dbf.dbv" )

    // Put the pointer to the first field in the variable <vlf_ptr>.
    // The "First" is not necessary here because the first call to this
    // function starts on the first field anyway, but is included
    // for clarity.
    vlf_ptr = V_WALK_DBV( "First" )

    DO WHILE !EMPTY( vlf_ptr )

       str = V_RETRIEVE( vlf_ptr )
       MEMOEDIT( str, 5, 5, 20, 75 )

       // Get a pointer to the next field (fields are in physical order)
       vlf_ptr = V_WALK_DBV()

    ENDDO

See Also: V_RETRIEVE() Disaster Recovery

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