PA_SetBlobField

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_SetBlobField (tNum; fNum; newBlob; len)

ParameterTypeDescription
tNumshortTable number of the field to access
fNumshortField number of the field to access
newBlobvoid*Pointer to the new BLOB data
lenlongSize of the BLOB in bytes

Description

The routine PA_SetBlobField fills the BLOB field number fNum of the current record of the table number tNum with the data pointed to by newBlob, of size len.

If the field is not a BLOB field, the routine does nothing and sets an error in PA_GetLastError().

Note that PA_SetBlobField duplicates newBlob, which still belongs to the plug-in after the call. To give the data without duplicating it, use PA_SetBlobHandleField.

Example

Fill the field content with the content of a BLOB variable (no error checking here)

   void BlobVariableToBlobField (PA_Variable v, short tNum, short fNum)
   {
      PA_Handle   blobH;
      char      *ptr;

      if(PA_GetVariableKind(v) == eVK_Blob)
      {
   // Since we do not touch to the BLOB data we do not have to duplicate it,
   // put it in the field, then dispose of it. We simply use the variable BLOB handle
         blobH = PA_GetBlobHandleVariable(v);

   // Lock and transfert the data
         ptr = PA_LockHandle(blobH);
         PA_SetBlobField(tNum, fNum, ptr, PA_GetHandleSize(blobH));
         PA_UnlockHandle(blobH);
      }
   }

See Also

PA_GetBlobField, PA_GetBlobHandleField, PA_SetBlobHandleField.

Error Handling

Use PA_GetLastError to see if an error occurred (eER_InvalidFileNumber, eER_InvalidFieldNumber)


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next