Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Paradox Engine 3.0 for C - blobs (binary large objects) are unique objects in the paradox clan. http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    Blobs (Binary Large OBjects) are unique objects in the Paradox clan.
    It is easiest to think of them as separate files attached to a table
    record.  The table record does not contain the actual data but rather
    a handle that points to the blob's location.  As such,  accessing a
    blob is very similar to accessing an additional file:

    Having read a table record,  get the blob handle...
      PXBlobOpenRead(recHandle, fldHandle, blbHandle);
    The size of the blob can be obtained with...
      PXBlobGetSize(blbHandle, size);
    Read the blob data into a buffer...
      PXBlobGet(blbHandle, size, offset, *buff);
      Up to 65,520 bytes can be read in each call to PXBlobGet.  If larger
      blobs are to be handled,  additional paging logic is required.
    When finished with the blob,  close it...
      PXBlobClose(blbHandle, 0);
      Note: the second paramater is ignored when the blob is opened for
      reading.

Creating blobs is similar...
    Get the blob handle...
      PXBlobOpenWrite(recHandle, fldHandle, blbHandle, size, saveCurrent);
    Write the blob data...
      PXBlobPut(blbHandle, size, offset, *buff);
      Up to 65,520 bytes can be written with each call to PXBlobPut.
      If larger blobs are to be handled,  additional paging logic is
      required.
    When finished with the blob,  close it...
      PXBlobClose(blbHandle, accept);
      The accept flag determines whether or not the data is saved when the
      table record is posted to the database.

Modifying a blob is somewhat more involved.  The process would go something
like this:
      Read the database record:
      PXRecGet(tblHandle, recHandle);

      Open the blob for reading
      PXBlobOpenRead(recHandle, fldHandle, blbHandle);

      Read the blob into a hold area (RAM,  EMS,  disk, etc)
      PXBlobGetSize(blbHandle, &size);
      buff = malloc(size);
      PXBlobGet(blbHandle, size, offset, *buff);

      Close the blob
      PXBlobClose(blbHandle, 0);

      Open the blob for writing
      PXBlobOpenWrite(recHandle, fldHandle, blbHandle, size, saveCurrent);

      Write the blob from the hold area
      PXBlobPut(blbHandle, size, offset, *buff);

      Close the blob
      PXBlobClose(blbHandle, accept);

      Update the record
      PXRecUpdate(tblHandle, recHandle);

Finally,  it is important to note that any functions with the potential
to change the current record pointer will clear the public blob (though not
a private blob) upon completion.  This includes the insert,  update,  and
append functions.  Even if the cursor does not actually move,  the blob is
cleared.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson