xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

BlobRootPut()

Stores data in the root area of a BLOB file.

Syntax

BlobRootPut( <xBlobData> ) --> lSuccess

Arguments

<xBlobData>
This is the value to assign to the BLOB. The supported data type of <xBlobData> can vary between RDDs maintaining BLOB files.

Return

The return value is .T. (true) if the data is successfully written to the root area of a BLOB file, otherwise .F. (false) is returned.

Description

BlobRootPut() is used to store data in the root area of a BLOB file. The root area is a unique storage place within a BLOB file that is only accessible with the functions BlobRootGet() and BlobRootPut().

When the BLOB file is open in SHARED mode, function BlobRootLock() must be called to avoid conflicts in concurrent file access. This is the only function that places a lock on the root area of a BLOB file.

Note:  the file Blob.ch must be #included for BlobRootPut() to work.

Info

See also:BlobRootDelete(), BlobRootGet(), BlobRootLock()
Category: Blob functions , Database functions
Header:blob.ch
Source:rdd\dbcmd.c, rdd\dbffpt\dbffpt1.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// This example creates a stand alone DBV file and stores the BLOB IDs
// in the root area of the BLOB file.

   #include "Blob.ch"

   REQUEST DBFBLOB

   PROCEDURE Main
      LOCAL aFile
      LOCAL aFiles  := Directory( "*.jpg" )
      LOCAL aBlobID := {}

      DbCreate( "ImageArchive", {}, "DBFBLOB" )

      USE ImageArchive NEW VIA "DBFBLOB"

      FOR EACH aFile IN aFiles
         AAdd( aBlobID, BlobDirectImport( 0, aFile[1] ) )
      NEXT

      IF BlobRootLock() .AND. BlobRootPut( aBlobID )
         BlobRootUnlock()
      ELSE
         Alert( "Unable to lock BLOB root;try again later" )
      ENDIF

      USE
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe