The ifx_lo_writewithseek() function

The ifx_lo_writewithseek() function performs a seek operation and then writes a specified number of bytes of data to an open smart large object.

Syntax

mint ifx_lo_writewithseek(LO_fd, buf, nbytes, offset, whence, error)
   mint LO_fd;
   char *buf;
   mint nbytes;
   ifx_int8_t *offset;
   mint whence;
   mint *error;
LO_fd
The LO file descriptor for the smart large object to which to write.
buf
A pointer to a buffer that contains the data that the function writes to the smart large object.
nbytes
The number of bytes to write to the smart large object. This value cannot exceed 2 gigabytes.
offset
A pointer to the 8-byte integer (INT8) offset from the starting seek position.
whence
A mint value that identifies the starting seek position.
error
A pointer to a mint that contains the error code that ifx_lo_writewithseek() sets.

Usage

The ifx_lo_writewithseek() function writes nbytes of data to the smart large object that the LO_fd file descriptor identifies. The function obtains the data to write from the user-defined buffer to which buf points. The buffer must be less than 2 gigabytes in size.

The write begins at the seek position of LO_fd that the offset and whence arguments indicate, as follows:
  • The whence argument identifies the position from which to start the seek.
    Valid values include the following constants, which the locator.h header file defines.
    Whence constant
    Starting seek position
    LO_SEEK_SET
    The start of the smart large object
    LO_SEEK_CUR
    The current seek position in the smart large object
    LO_SEEK_END
    The end of the smart large object
    • The offset argument identifies the offset, in bytes, from the starting seek position (that the whence argument specifies) to which the seek position should be set.

If the database server writes less than nbytes of data to the smart large object, the ifx_lo_writewithseek() function returns the number of bytes that it wrote and sets the error value to point to a value that indicates the reason for the incomplete write operation. This condition can occur when the sbspace runs out of space.

Return codes

>=0
The number of bytes that the function has written from the buf character buffer to the smart large object.
-1
The function was not successful; examine the error for a detailed error code.