Click or drag to resize

DbServer.BLOBDirectImport Method

Import a file into a BLOB file and return a pointer to the data.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.7
	nPointer AS USUAL := NIL,
	oFSSource AS USUAL := NIL
Request Example View Source


nPointer (Optional)
Type: Usual
A pointer to the BLOB data which will be released after the import.  This pointer can be obtained using DBServer:BLOBDirectPut(), DBServer:BLOBDirectImport(), or DBServer:FieldInfo(DBS_BLOB_POINTER, <nFieldPos>).  Passing 0 disables the release of data.
Important!  If specified, DBServer:BLOBDirectImport() releases the space associated with <nOldPointer> for reuse by other data.  Therefore, it is illegal to use <nOldPointer> with any of the BLOB methods after passing it as an argument to this method.  Use the method's return value to refer to the newly stored data.
oFSSource (Optional)
Type: Usual
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
A numeric pointer to the BLOB image stored in <oFSTargetFile> | <cTargetFile>.
This method attempts to open <oFSTargetFile> | <cTargetFile> 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 <oFSTargetFile> | <cTargetFile> except that you must have enough disk space to make the copy.
DBServer:BLOBDirectImport() provides a mechanism for copying the contents of a file into a BLOB file. DBServer:BLOBDirectImport() is used in conjunction with DBServer:BLOBDirectExport() to transfer data back and forth between external files and BLOB files.  You can use DBServer:BLOBDirectImport() 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.
Important!  After importing a file with DBServer:BLOBDirectImport(), nNewPointer, the return value, is the only way to access the data from the BLOB file.  It is up to you, the developer, to provide permanent storage for this reference (see example below)
Tip Tip
DBServer:FieldInfo(DBS_BLOB_TYPE, <nFieldPos>) will return "C" (string) for any memo field created using DBServer:BLOBDirectImport().
This example imports a .BMP file to be part of an array of startup data.  The data, stored in the root area of the BLOB file, could then be used to display the application's startup screen:
 3LOCAL aSettings AS ARRAY
 4LOCAL oDBCust AS DBServer
 5cBMPFile := "logo.bmp"
 6aSettings := {}
 7// Customer database where startup parameters
 8// are stored for convenience
 9oDBCust := Customer{}
10// Get default path settings
11AAdd(aSettings, StartPaths())
12// Get default color settings
13AAdd(aSettings, DefaultColors())
14// Get company logo for display at startup.
15// There is nothing to free because this
16// is the first time importing.
17nPointer := oDBCust:BLOBDirectImport(0, cBMPFile)
18AAdd(aSettings, nPointer)
19// Store the settings in the root area of
20// the customer.fpt file
See Also