version 2003
PA_SetBlobField (tNum; fNum; newBlob; len)
Parameter | Type | Description | |
tNum | short | Table number of the field to access | |
fNum | short | Field number of the field to access | |
newBlob | void* | Pointer to the new BLOB data | |
len | long | Size 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)