Siebel eScript Language Reference > Methods Reference > BLOB Methods >

Write BLOB Data Method


The Write BLOB Data method writes data to a binary large object. It returns an integer that identifies the byte offset of the byte that occurs after the end of the data that this method writes. If it writes data at the end of the BLOB, then this integer identifies the size of the BLOB.

You can write code that adds data at any position in a BLOB. The data length is variable. This method does not pad each data element with null values as a way to make every data element a uniform length. The exact length depends on the CPU. Thirty two bytes is a common length.

For more information, see Usage of the Term Put.

Format A

Blob.put(blobVar[, offset], data, dataType)

Format B

Blob.put(blobVar[, offset], buffer, bufferLen)

Format C

Blob.put(blobVar[, offset], srcStruct, blobDescriptor dataDefinition)

To pass the contents of an existing BLOB that resides in the srcStruct argument to the blobVar argument, you can use format C.

Arguments

Table 47 describes the arguments for the Write BLOB Data method.

Table 47. Arguments for the Write BLOB Data Method
Argument
Description

blobVar

The name of the binary large object that this method manipulates.

offset

The position in the BLOB where this method adds data. If you do not provide a value for the offset argument, then this method does one of the following depending on if the BLOB is defined:

  • BLOB is defined. Adds data at the end of the BLOB.
  • BLOB is not defined. Adds data at offset 0.

data

The data that this method writes.

dataType

The format of the data in the BLOB. This method converts the data to the format that you specify in the dataType argument, and then copies this data to the position that you specify in the offset argument.

If the value that you specify in the dataType argument is not the length of a byte buffer, then the dataType argument must include one of the values you use with a BLOB descriptor. For more information, see Values You Must Use with a BLOB Descriptor.

bufferLen

An integer that specifies the buffer length.

srcStruct

A BLOB that contains the data that this method writes.

blobDescriptor dataDefinition

A blobDescriptor object that describes the format of the data in the BLOB.

Example

Assume you send a data pointer to an external C library. Assume the library expects data in the following packed C structure:

struct foo
{
   signed char a;
   unsigned int b;
   double c;
};

The following example creates a structure from three corresponding variables and 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;
}

The following example creates a structure from three corresponding variables but does not include an offset:

functionBuildFooBlob(a, b, c)
{
   Blob.put(foo, a, SWORD8);
   Blob.put(foo, b, UWORD16);
   Blob.put(foo, c, FLOAT64);
   return foo;
}

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.