[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
BLOBDIRECTEXPORT()
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.
CA-Clipper supplies the DBFCDX driver, which uses the BLOB file storage
mechanism by default, and the DBFMEMO driver, which you can use as a
driver with a named super RDD (see MEMOSETSUPER()). Refer to the RDD
Features in the "Replaceable Database Driver Architecture" chapter of
the Drivers Guide for further information on using this
driver.BLOB:definitionBLOB:drivers supporting
Syntax
BLOBDirectExport(<nPointer>, <cTargetFile>, [<nMode>])
--> lSuccess
Arguments
<nPointer> is a pointer to the BLOB data. This pointer can be
obtained using BLOBDIRECTPUT(), BLOBDIRECTEXPORT(), or
DBFIELDINFO(DBS_BLOB_POINTER, <nFieldPos>).
<cTargetFile> is 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 another process is using the file, for example, NETERR() is set
to true (.T.). Concurrency control:and BLOBDIRECTEXPORT()
<nMode> is a constant defining the copy mode, as shown in the table
below:
Copy Mode Constants
------------------------------------------------------------------------
Constant Description
------------------------------------------------------------------------
BLOB_EXPORT_APPEND Appends to the file
BLOB_EXPORT_OVERWRITE Overwrites the file (this is the default)
------------------------------------------------------------------------
Returns
BLOBDIRECTEXPORT() returns true (.T.) if successful; otherwise, it
returns false (.F.).
Description
By default, BLOBDIRECTEXPORT() 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 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:
FUNCTION PUTPIX()
LOCAL cPixFile
LOCAL nPointer
LOCAL aBLOBPtrs
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[2]
// Export picture pointed to by nPointer to a file
IF !BLOBDirectExport(nPointer, cPixFile, ;
BLOB_EXPORT_OVERWRITE)
Alert("Export of picture " + cPixFile + ";
failed!")
ELSE
// Code for displaying picture would go here
ENDIF
Files Library is CLIPPER.LIB.
See Also:
BLOBDIRECTIMP()
BLOBEXPORT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson