BLOBRootGet Function | |
Retrieve the data from the root area of a BLOB file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION BLOBRootGet() AS USUAL
public static Usual BLOBRootGet()
Request Example
View SourceReturn Value
Type:
Usual
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().
Remarks
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, then demonstrates how to allow the user to modify the settings are restore them in the BLOB file:
1FUNCTION UpdateSettings()
2 LOCAL aSettings AS ARRAY
3 USE customer NEW SHARED VIA "DBFCDX"
4 IF BLOBRootLock()
5
6 aSettings := BLOBRootGet()
7 IF EMPTY(aSettings)
8
9
10 aSettings := GetDefaultSettings()
11 ENDIF
12
13
14 IF ModifySettings(aSettings)
15
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