Click or drag to resize

DbServer.BLOBDirectExport Method

X#
Export the contents of a binary large object (BLOB) pointer to a file.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD BLOBDirectExport(
	nPointer,
	oFSTarget,
	kMode
) AS USUAL CLIPPER
Request Example View Source

Parameters

nPointer (Optional)
Type: Usual
A pointer to the BLOB data. This pointer can be obtained using DBServer:BLOBDirectPut(), DBServer:BLOBDirectExport(), or DBServer:FieldInfo(DBS_BLOB_POINTER, nFieldPos).
oFSTarget (Optional)
Type: Usual
A string or filespec object that specifies 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 oFSTarget does not exist, it is created. If it exists, this method 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 and the data server's Status property is set.
kMode (Optional)
Type: Usual
A constant defining the copy mode, as shown in the table below:
ConstantDescription
BLOB_EXPORT_APPEND Appends to the file
BLOB_EXPORT_OVERWRITE Overwrites the file—this is the default

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
Tip Tip
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. Refer to the "RDD Specifics" appendix in the Programmer's Guide for further information on using this driver.
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:
X#
 1FUNCTION PutPix()
 2LOCAL cPixFile AS STRING
 3LOCAL nPointer
 4LOCAL aBLOBPtrs AS ARRAY
 5LOCAL oDBCust AS DBServer
 6cPixFile := "picture.gif"
 7// Customer data server with a picture of each
 8// customer stored in a field called Pix
 9oDBCust := Customer{}
10// Assumes that the program previously stored
11// an array of direct BLOB pointers into the root area of the BLOB file.
12// The picture that we want is assumed to be the second array element.
13aBLOBPtrs := BLOBRootGet()
14nPointer := aBLOBPtrs[2]
15// Export picture pointed to by nPointer to a file
16IF !oDBCust:BLOBDirectExport(nPointer, cPixFile, BLOB_EXPORT_OVERWRITE)
17Alert("Export of picture " + cPixFile + "failed!")
18ELSE
19// Code for displaying picture would go here
20ENDIF
See Also