Click or drag to resize

BLOBDirectPut Function

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

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION BLOBDirectPut(
	 nOldPointer AS USUAL,
	 uBLOB AS USUAL
) AS USUAL
View Source

Parameters

nOldPointer
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
Type: Usual
The data you want to put into the BLOB file.  <uBLOB> can be any X# usual data type, except code block and object.

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#
FUNCTION PutSettings(aColors AS ARRAY,;
        aPaths AS ARRAY, aPassWords AS ARRAY) AS VOID
LOCAL aSettings AS ARRAY
        USE setup NEW VIA DBFBLOB
        aSettings := {}
        AADD(aSettings, BLOBDirectPut(0, aColors))
        AADD(aSettings, BLOBDirectPut(0, aPaths))
        AADD(aSettings, BLOBDirectPut(0, aPassWords))
        BLOBRootPut(aSettings)
        CLOSE
FUNCTION GetColors() AS ARRAY
        LOCAL aSettings AS ARRAY
        LOCAL aColors   AS ARRAY
        USE setup NEW VIA DBFBLOB
        aSettings := BLOBRootGet()
        aColors := BLOBDirectGet(aSettings[1])
        CLOSE
        RETURN aColors
See Also