Export the contents of a binary large object (BLOB) pointer to a file.
Note: A BLOB file (.DBV or .FPT) is used for storing memo field information, as an alternative to the standard .DBT file mechanism supported by some RDDs. It is a more powerful and efficient mechanism for storing and retrieving large amounts of data than using .DBT files. X# supplies the DBFCDX driver, which uses the BLOB file storage mechanism by default, and the DBFBLOB driver, which you can use as an inherited driver with other RDDs.
XSharp.RT (in XSharp.RT.dll) Version: 2.2a
Syntax View Source
nPointer AS USUAL,
cTargetFile AS USUAL,
kMode AS USUAL
) AS LOGIC
public static bool BLOBDirectExport(
[DefaultParameterValueAttribute(0, 1)] Usual nPointer,
[DefaultParameterValueAttribute(0, 1)] Usual cTargetFile,
[DefaultParameterValueAttribute(0, 1)] Usual kMode
- Type: Usual
A pointer to the BLOB data. This pointer can be obtained using BLOBDirectPut(), BLOBDirectExport(), or DBFieldInfo(DBS_BLOB_POINTER, <nFieldPos>).
- Type: Usual
The name of the target file where the BLOB data will be written, including an optional drive, directory, and extension. See SetDefault() and SetPath() for file searching and creation rules. No default extension is assumed.
If <cTargetFile> does not exist, it is created. If it exists, this function attempts to open the file in exclusive mode and, if successful, the file is written to without warning or error. If access is denied because, for example, another process is using the file, NetErr() is set to TRUE.
- Type: Usual
A constant defining the copy mode, as shown in the table below:
BLOB_EXPORT_APPEND Appends to the file
BLOB_EXPORT_OVERWRITE Overwrites the file — this is the default
TRUE if successful; otherwise, FALSE.
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
This example extracts an array of pointers from the BLOB file's root area, then uses one of the pointers to export a picture to a file:
LOCAL cPixFile AS STRING
LOCAL aBLOBPtrs AS ARRAY
cPixFile := "picture.gif"
// Customer database with a picture of
// each customer stored in a field called Pix
USE customer NEW VIA "DBFCDX"
// Assumes that the program previously
// stored an array of direct BLOB pointers
// into the root area of the BLOB file.
// The picture that we want is assumed to
// be the second array element.
aBLOBPtrs := BLOBRootGet()
nPointer := aBLOBPtrs
// Export picture pointed to by nPointer to a file
IF !BLOBDirectExport(nPointer, cPixFile, ;
Alert("Export of picture " + cPixFile + ";
// Code for displaying picture would go here