Click or drag to resize

DbServer.BLOBImport Method

X#
Read the contents of a file as a BLOB, identified by a memo field number.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD BLOBImport(
	uField,
	oFSSource
) AS USUAL CLIPPER
Request Example View Source

Parameters

uField (Optional)
Type: Usual
The name, number, or symbol representing the position of the field in the database file structure.
oFSSource (Optional)
Type: Usual
A string or filespec object that specifies the name of the file from which to read the BLOB data, including an optional drive, directory, and extension. See SetDefault() and SetPath() for file searching and creation rules. No default extension is assumed.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
This method attempts to open the source file in shared mode. If the file does not exist, a runtime error is raised. If the file is successfully opened, the operation proceeds. If access is denied because, for example, another process has exclusive use of the file, NetErr() is set to TRUE and the data server's Status property is set. Refer to the 'Concurrency Control' chapter in the Programmer's Guide for more information on resolving concurrency conflicts.
Tip Tip
There are no restrictions on the size of the source file except that you must have enough disk space to make the copy.
DBServer:BLOBImport() provides a mechanism for copying the contents of a file into a memo field as BLOB data. DBServer:BLOBImport() is used in conjunction with DBServer:BLOBExport() to transfer BLOB data back and forth between files and memo fields. You can use DBServer:BLOBImport() with a variety of file types, including graphics images, word processor files, and printer fonts. These two methods are excellent for creating databases of documents, graphics, sounds, and so on. DBServer:BlobImport() sends a NotifyFieldChange message upon successful completion.
Tip Tip
DBServer:FieldInfo(DBS_BLOB_TYPE, uFieldPos) will return "C" (string) for any memo field created using DBServer:BLOBImport().
Examples
This example imports information from a word processing document into a field, then uses DBServer:BLOBGet() to extract the first 25 characters of the field:
X#
 1FUNCTION Populate()
 2LOCAL oDBCust AS DBServer
 3oDBCust := Customer{}
 4// Construct unique name based on last name     // and id
 5DO WHILE .NOT. oDBCust:EOF
 6oDBCust:GetPix("Pix", ;
 7Substr(oDBCust:LastName, 1, 4) + oDBCust:CustID)
 8oDBCust:Skip()
 9ENDDO
10METHOD GetPix(cPixField, cPixFile) CLASS Customer
11LOCAL nPos
12nPos := SELF:FieldPos(cPixField)
13// Import the picture file into indicated     // field
14IF !SELF:BLOBImport(nPos, cPixFile)
15Alert("Import of picture " + cPixFile + "     failed!")
16ENDIF
See Also