xHarbour Reference Documentation > Function Reference |
Exports the contents of a memo field holding a binary large object (BLOB) to a file.
BlobExport( <nFieldPos>, <cTargetFile>, [<nMode>] ) --> lSuccess
Constants for BlobExport()
Constant | Description |
---|---|
BLOB_EXPORT_APPEND | Appends to the target file |
BLOB_EXPORT_OVERWRITE *) | Overwrites the target file |
*) default value |
The return value is .T. (true) if data is successfully exported, otherwise .F. (false) is returned.
BlobExport() copies the contents of a single binary large object (BLOB) to an external file. The object is identified by the ordinal position of the memo field holding the BLOB data. This position can be obtained using function FieldPos().
If the target file does not exist, it is created. If it exists, it is either overwritten or data is appended to the file, depending on <nMode>. When the file operation fails, BlobExport() returns .F. (false) and function NetErr() is set to .T. (true). This can happen when the target file is currently locked by another process in concurrent file access.
Note: the file Blob.ch must be #included for BlobExport() to work.
See also: | BlobDirectGet(), BlobDirectExport(), BlobDirectImport(), BlobDirectPut(), BlobRootGet(), DbFieldInfo() |
Category: | Blob functions , Database functions |
Header: | blob.ch |
Source: | rdd\dbcmd.c, rdd\dbffpt\dbffpt1.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates how to export BLOB data to an external file. #include "Blob.ch" REQUEST DBFCDX PROCEDURE Main LOCAL nFieldPos USE PhotoArchive ALIAS Photos VIA "DBFCDX" LOCATE FOR FIELD->PhotoName = "Sunset in Malibu" IF Found() nFieldPos := FieldPos( "JPEG" ) IF BlobExport( nFieldPos, "Sunset.jpg" ) ? "File successfully eported" ELSE ? "Unable to export BLOB data" ENDIF ENDIF USE RETURN
http://www.xHarbour.com