The lld_write() function

This function writes data to an open large object, starting at the current position.

Syntax

API
mi_integer lld_write (conn, io, buffer, bytes, error)
   MI_CONNECTION*                conn;
   LLD_IO*                       io;
   void*                         buffer;
   mi_integer                    bytes;
   mi_integer*                   error; 
ESQL/C
int lld_write (LLD_IO* io, void* buffer, 
            int bytes, int* error); 
conn
The connection descriptor established by a previous call to the mi_open() or mi_server_connect() functions. This parameter is for the API interface only. In the ESQL/C and SQL versions of this function, you must already be connected to a server.
io
A pointer to an LLD_IO structure created with a previous call to the lld_open() function.
buffer
A pointer to a buffer from which to write the data. The buffer must be at least as large as the number of bytes specified in the bytes parameter.
bytes
The number of bytes to write.
error
An output parameter in which the function returns an error code.

Usage

Before calling this function, you must open the large object with a call to lld_open() and set the LLD_WRONLY or LLD_RDWR flag. The lld_write() function begins writing from the current position. By default, when you open a large object, the current position is the beginning of the object. You can call lld_seek() to change the current position.

If you want to append data to the object, specify the LLD_APPEND flag when you open the object to set the current position to the end of the object. If you have done so and have opened the object for reading and writing, you can still use lld_seek to move around in the object and read from different places. However, as soon as you begin to write, the current position is moved to the end of the object to guarantee that you do not overwrite any existing data.

Return codes

On success, the lld_write() function returns the number of bytes that it has written.

On failure, for an API function it returns MI_ERROR; for an ESQL/C function, it returns -1.

Context

The lld_open() function

The lld_seek() function

The lld_tell() function