Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>blobrootget()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BLOBROOTGET()
 Retrieve the data from the root area of a BLOB file
------------------------------------------------------------------------------
 Syntax

     BLOBROOTGET() --> uBLOB

 Returns

     BLOBROOTGET() returns the data retrieved from the root of the BLOB file.
     The data type of the return value depends on the actual data stored.
     Use VALTYPE() or USUALTYPE() to determine the data type.  Note that
     BLOBROOTGET() returns NIL if the root reference has never been written
     to with BLOBROOTPUT().

 Description

     BLOBROOTGET() allows the retrieval of a BLOB from the root of a BLOB
     file in a work area.  By default, this function operates on the
     currently selected work area.  It can be made to operate on an
     unselected work area by specifying it within an aliased expression.

     Note:  Because the root data does not reference a particular record
     in the database file, the DBRLOCK() will not protect this root storage
     reference.  Therefore, if the database file is opened in shared mode,
     you should use BLOBROOTLOCK() before calling BLOBROOTGET().

 Examples

     .  This example uses BLOBROOTGET() to read system settings from a
        BLOB file into an array, and then demonstrates how to allow the user
        to modify the settings and restore them in the BLOB file:

        FUNCTION UPDATESETTINGS()
           LOCAL aSettings

           USE customer NEW SHARED VIA "DBFCDX"

           IF BLOBROOTLOCK()
              // Get any existing settings
              aSettings := BLOBROOTGET()

              IF Empty(aSettings)
                 // This function would populate aSettings
                 // with default data
                 aSettings := GETDEFAULTSETTINGS()
              ENDIF

              // This function would allow the user to
              // modify the settings.
              IF ModifySettings(aSettings)
                 // Finally, store the settings
                 BLOBRootPut(aSettings)
              ENDIF
              BLOBROOTUNLOCK()
           ELSE
              aSettings := {}
              Alert("Could not obtain a lock on the root;
                 area")
           ENDIF

           CLOSE

           RETURN aSettings


See Also: BLOBROOTLOCK() BLOBROOTPUT() DBRLOCK() DBUSEAREA()

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