SYNOPSIS

\*(T<#include <opendbx/api.h>\*(T>

\*(T<ssize_t odbx_lo_read\*(T> \kx \*(T<(odbx_lo_t* lo, void* buffer, size_t buflen);\*(T>

DESCRIPTION

To get the content of a large object, \*(T<odbx_lo_read\*(T>() fetches the data in one or more pieces from the server and stores it into the user supplied \*(T<buffer\*(T>. After opening the large object using \*(T<odbx_lo_open\*(T>(), the first call to \*(T<odbx_lo_read\*(T>() will return the bytes from the beginning. The second and all other calls will store subsequent parts of the large object content into the \*(T<buffer\*(T> until the end of the data is reached. To reread the content a second time, you have to close the large object handle and reopen it again as some databases provide no way to reposition the internal file position indicator for the stream.

The \*(T<lo\*(T> parameter has to be the large object handle created and returned by \*(T<odbx_lo_open\*(T>() via its second parameter. It becomes invalid after it was supplied to \*(T<odbx_lo_close\*(T>() and this function will return an error in this case. The large object content fetched from the server is stored into the user supplied \*(T<buffer\*(T> up to \*(T<buflen\*(T> bytes.

RETURN VALUE

\*(T<odbx_lo_read\*(T>() returns the number of bytes placed into \*(T<buffer\*(T>, which may be up to \*(T<buflen\*(T> bytes. If the end of the content is reached and no more data is available, the return value will be 0. 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 \*(T<odbx_error\*(T>() and \*(T<odbx_error_type\*(T>() to get further details.

ERRORS

-\*(T<ODBX_ERR_BACKEND\*(T>

The native database library couldn't read from the large object

-\*(T<ODBX_ERR_HANDLE\*(T>

\*(T<lo\*(T> is NULL or the supplied large object handle is invalid

RELATED TO odbx_lo_read…

\*(T<odbx_lo_open\*(T>(), \*(T<odbx_lo_close\*(T>()