Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference > Siebel eScript Commands > BLOB Objects >
Blob.put() Method
The Blob.put method puts data into a specified location within a binary large object.
Syntax A
Blob.put(blobVar[, offset], data, dataType)
Syntax B
Blob.put(blobVar[, offset], buffer, bufferLen)
Syntax C
Blob.put(blobVar[, offset], srcStruct, blobDescriptor dataDefinition)
Returns
An integer representing the byte offset for the byte after the end of the data just written. If the data is put at the end of the BLOB, the size of the BLOB.
Usage
This method puts data into a specified location of a binary large object (BLOB) and, along with Blob.get(), allows for direct access to memory within a BLOB variable. Data can be placed at any location within a BLOB. The contents of such a variable may be viewed as a packed structure, that is, a structure that does not pad each member with enough nulls to make every member a uniform length. (The exact length depends on the CPU, although 32 bytes is common.)
Syntax C is used to pass the contents of an existing BLOB (srcStruct) to the blobVar.
If a value for offset is not supplied, then the data is put at the end of the BLOB, or at offset 0 if the BLOB is not yet defined.
The data is converted to the specified dataType and then copied into the bytes specified by offset.
If dataType is not the length of a byte buffer, then it must have one of the values listed for blobDescriptors in The blobDescriptor Object.
Example
If you were sending a pointer to data in an external C library and knew that the library expected the data in a packed C structure of the form:
struct foo
{
signed char a;
unsigned int b;
double c;
};and if you were building this structure from three corresponding variables, then such a building function might look like the following, which returns the offset of the next available byte:
function BuildFooBlob(a, b, c)
{
var offset = Blob.put(foo, 0, a, SWORD8);
offset = Blob.put(foo, offset, b, UWORD16);
Blob.put(foo, offset, c, FLOAT64);
return foo;
}or, if an offset were not supplied:
functionBuildFooBlob(a, b, c)
{
Blob.put(foo, a, SWORD8);
Blob.put(foo, b, UWORD16);
Blob.put(foo, c, FLOAT64);
return foo;
}See Also
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference Published: 18 April 2003 |