<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > BlobToFile |
Declaration
function BlobToFile( sFieldName, sFileName: String ): WordBool;
Description
Writes a BLOB stored in a memo file directly to a new disk file. If a file of the same name exists, it is overwritten without warning.
Parameters
sFieldName: The name of the BLOB field within the table to read the data from.
sFileName: The name of the target file qualified with a complete path and extension (for local tables only).
When working with a remote table via Apollo Database Server, you may only extract the BLOB contents out into the same Database directory as the table. The remote client cannot specify a physical server drive/path location and must use the defined server alias instead. Any physical drive/path included in the sFileName parameter will be ignored for remote tables.
Return Value
Return value is True if the file was created and written correctly or False if anything goes wrong (e.g., invalid field name, etc.). The file will not exist if the return is False.
Delphi Example
// Stores a disk file to a MEMO field as a BLOB
with ApTbl do
begin
AppendBlank;
Replace( 'NOTES', R_BLOBFILE, PChar('readme.wri') );
ShowMessage( 'Replaced ' + IntToStr( RecNo ));
end;
// Writes the BLOB from the MEMO field back to the disk
if not ApTbl.BlobToFile( 'NOTES', 'readme2.wri') then
begin
ShowMessage( 'Blob file write failed' );
end
else
begin
ShowMessage( 'Blob file write succeeded' );
end;
See Also