odbx_lo_write(3)

NAME
odbx_lo_write - Writes buffer content into the large object

SYNOPSIS
\FC#include <opendbx/api.h>\F[]

\FCssize_t odbx_lo_write\F[]
\FC(odbx_lo_t* lo, void* buffer, size_t buflen);\F[]

DESCRIPTION
\FCodbx_lo_write\F[]() sends the data supplied in \FCbuffer\F[] to the server for storing it inside the large object. The function can be called more than once to add subsequent parts of the content to the object. If it isn't a new or empty object, the existing data will be overwritten and truncated to the new size. It's not possible to update only parts of the content as some databases doesn't support to position the internal file position indicator.

The \FClo\F[] parameter has to be the large object handle created and returned by \FCodbx_lo_open\F[]() via its second parameter. It becomes invalid after it was supplied to \FCodbx_lo_close\F[]() and this function will return an error in this case. The data which should be send to the server is read from \FCbuffer\F[] up to \FCbuflen\F[] bytes.

RETURN VALUE
\FCodbx_lo_write\F[]() returns the number of bytes read from \FCbuffer\F[] and sent to the database server, which may be up to \FCbuflen\F[] bytes. It isn't guaranteed that the complete chunk was sent to the server, so the returned size may be less than the value in \FCbuflen\F[]. On error, a code whose value is less than zero is returned if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to \FCodbx_error\F[]() and \FCodbx_error_type\F[]() to get further details.

ERRORS

-\FCODBX_ERR_BACKEND\F[]
    The native database library couldn't write to the large object successfully

-\FCODBX_ERR_HANDLE\F[]
    \FClo\F[] is NULL or the supplied large object handle is invalid

SEE ALSO
\FCodbx_lo_open\F[](), \FCodbx_lo_close\F[]()