Click or drag to resize

BLOBRootPut Function

X#
Store data in the root area of a BLOB file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION BLOBRootPut(
	uBLOB
) AS USUAL CLIPPER
Request Example View Source

Parameters

uBLOB (Optional)
Type: Usual
The data you want to put into the BLOB file's root area. uBLOB can be any X# usual data type, except code block and object.

Return Value

Type: Usual
TRUE if successful; otherwise FALSE.
Remarks
BLOBRootPut() allows the storage of one — and only one — piece of data to a BLOB file's root area (there is no size limitation on this one piece of data).
After storing the new data, BLOBRootPut() releases the space associated with any data previously stored in the BLOB file's root 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 BLOBRootPut().
Examples
This example uses BLOBRootPut() to store system settings to a BLOB file after modification:
X#
 1FUNCTION UpdateSettings()
 2    LOCAL aSettings AS ARRAY
 3    USE customer NEW SHARED VIA "DBFCDX"
 4    IF BLOBRootLock()
 5        // Get any existing settings
 6        aSettings := BLOBRootGet()
 7        IF EMPTY(aSettings)
 8            // This function would populate aSettings
 9            // with default data
10            aSettings := GetDefaultSettings()
11        ENDIF
12        // This function would allow the user to
13        // modify the settings.
14        IF ModifySettings(aSettings)
15            // Finally, store the settings
16            BLOBRootPut(aSettings)
17        ENDIF
18        BLOBRootUnLock()
19    ELSE
20        aSettings := {}
21        Alert("Could not obtain a lock on the root;
22            area")
23    ENDIF
24    CLOSE
25    RETURN aSettings
See Also