Click or drag to resize

BLOBDirectPut Function

X#
Put data in a BLOB file without referencing a specific field.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION BLOBDirectPut(
	nOldPointer,
	uBlob
) AS USUAL CLIPPER
Request Example View Source

Parameters

nOldPointer (Optional)
Type: Usual
A reference to previously stored BLOB data.
This reference can be obtained using BLOBDirectPut(), BLOBDirectImport(), or DBFieldInfo(DBS_BLOB_POINTER, nFieldPos).
If other than 0, the data referenced by nOldPointer is replaced by uBLOB; otherwise, uBLOB is added to the current contents of the BLOB file.

Important!
If specified, BLOBDirectPut() releases the space associated with nOldPointer for reuse by other data.
Therefore, it is illegal to use nOldPointer with any of the BLOB functions after passing it as an argument to this function.
Use the function's return value to refer to the newly stored data.
uBlob (Optional)
Type: Usual

Return Value

Type: Usual
A numeric pointer to the uBLOB data.
Remarks
BLOBDirectPut() stores variable length BLOB data without creating a link with a particular memo field in a database file. After adding data to a BLOB file using BLOBDirectPut(), you should store the function's return value, as this is the only way to access the data from the BLOB file.
It is up to you, the developer, to provide permanent storage for this reference (see BLOBRootPut()). 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
Examples
This example illustrates storing setup information in a BLOB file, then selectively retrieving the stored information:
X#
 1FUNCTION PutSettings(aColors AS ARRAY,;
 2    aPaths AS ARRAY, aPassWords AS ARRAY) AS VOID
 3LOCAL aSettings AS ARRAY
 4    USE setup NEW VIA DBFBLOB
 5    aSettings := {}
 6    AADD(aSettings, BLOBDirectPut(0, aColors))
 7    AADD(aSettings, BLOBDirectPut(0, aPaths))
 8    AADD(aSettings, BLOBDirectPut(0, aPassWords))
 9    BLOBRootPut(aSettings)
10    CLOSE
11FUNCTION GetColors() AS ARRAY
12    LOCAL aSettings AS ARRAY
13    LOCAL aColors   AS ARRAY
14    USE setup NEW VIA DBFBLOB
15    aSettings := BLOBRootGet()
16    aColors := BLOBDirectGet(aSettings[1])
17    CLOSE
18    RETURN aColors
See Also