[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BLOBIMPORT()
 Read the contents of a file as a BLOB, identified by a memo field number
------------------------------------------------------------------------------
 Syntax

     BLOBImport(<nFieldPos>, <cSourceFile>) --> lSuccess

 Arguments

     <nFieldPos> is the position of the field in the database file
     structure.

     <cSourceFile> is 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.

     This function attempts to open <cSourceFile> 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 another process has exclusive use of the file, for example,
     NETERR() is set to true (.T.).  Concurrency control:and BLOBIMPORT()

     Note:  There are no restrictions on the size of <cSourceFile> except
     that you must have enough disk space to make the copy.

 Returns

     BLOBIMPORT() returns true (.T.) if successful; otherwise, it returns
     false (.F.).

 Description

     BLOBIMPORT() provides a mechanism for copying the contents of a file
     into a memo field as BLOB data.  By default, this function operates on
     the currently selected work area.  It can be made to operate on an
     unselected work area by specifying it within an aliased expression.

     BLOBIMPORT() is used in conjunction with BLOBEXPORT() to transfer BLOB
     data back and forth between files and memo fields.  You can use
     BLOBIMPORT() with a variety of file types, including graphic images,
     word processor files, and printer fonts.  These two functions are
     excellent for creating databases for documents, graphics, sounds, etc.

     Note:  DBFieldInfo(DBS_BLOB_TYPE, <nFieldPos>) will return "C"
     (string) for any memo field created using BLOBIMPORT().

 Examples

     .  This example imports information from a word processing
        document into a field, and then uses BLOBGET() to extract the first
        25 characters of the field:

        FUNCTION POPULATE()
           USE customer NEW VIA "DBFCDX"

           // Construct unique file name based on last
           // name and id
           DO WHILE .NOT. EOF()
              GetPix("Pix", Substr(LastName, 1, 4) + CustID)
              Customer->DBSKIP()
           ENDDO
        FUNCTION GetPix(cPixField, cPixFile)
           LOCAL nPos

           nPos := FieldPos(cPixField)

           // Import the picture file into indicated field
           IF !BLOBImport(nPos, cPixFile)
              Alert("Import of picture " + cPixFile + ";
              failed!")
           ENDIF


See Also: BLOBEXPORT() DBFIELDINFO()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson