company logo

Value :: write - Write data for BLOB properties

The function allows writing (binary) data for BLOB properties. As long as the data does not exceed the size defined in the property definition, i.e. as long as the property instance is not over-sized, MEMO properties may also be updated by assigning a string value to the property. This does not work properly for BLOB data. The only way to write BLOB data is using write() . The function also supports partially updating BLOB properties.


Return value:  Length ( int32  )

The length is the size allocated for an instance or area.

Implementation overview

Implementation details

  1. Write complete binary data block to BLOB
    int32 Value  :: write ( odaba::Binary &cBinary )

    The function writes the complete binary data block passed in cBinary to the BLOB property. The old content is overwritten completely. The size of the property will be changed to the size of the binary data block passed.

    // write complete binary data block to image property

      image.write(bin_data);

    // clear BLOB property image

      bin_data.clear();

      image.write(bin_data);

    Notes:

    In order to clear a BLOB property without deleting it, one may write an empty binary data block.

    • cBinary - Binary data block handle

      Constant reference to a binary data block handle, which may contain binary data up to 2 GB.

  2. to list
  3. Update BLOB property partially
    int32 Value  :: write ( odaba::Binary &cBinary, int32 iPosition, int32 iLength )

    The function allows updating a BLOB property instance partially. Data from the binary data block is written to at position iPosition in the property instance using length passed in iLength . The length of the BLOB property remains unchanged unless iPosition + iLength exceeds the length of the current data block.

    In order to cut an existing BLOB area, one may pass -1 as position. In this case, the area size is set to the length passed in iLength and the BLOB data will be overwritten from the beginning.

    When passing -1 in iLength , the the current length of the binary data block is assumed to be the length. When the size passed in iLength exceeds the size of the data block passed in cBinary , the remaining part of the binary data block will be written ( Binary ::length()- iPosition ).

    // update data

      image.write(bin_data,100,1000);

    // overwrite completely

      image.write(bin_data,-1,-1);

    // overwrite from beginning without changing size

      image.write(bin_data,0,1000);

    // overwrite from beginning and cut

      image.write(bin_data,-1,1000);

    • cBinary - Binary data block handle

      Constant reference to a binary data block handle, which may contain binary data up to 2 GB.

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

    • iLength - Length

      The length is the size allocated for an instance or area.

  4. to list