xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_blob_read.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_BLOB_READ 3
3.Os
4.Sh NAME
5.Nm sqlite3_blob_read
6.Nd read data from a BLOB incrementally
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3_blob_read
11.Fa "sqlite3_blob *"
12.Fa "void *Z"
13.Fa "int N"
14.Fa "int iOffset"
15.Fc
16.Sh DESCRIPTION
17This function is used to read data from an open BLOB handle
18into a caller-supplied buffer.
19N bytes of data are copied into buffer Z from the open BLOB, starting
20at offset iOffset.
21.Pp
22If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR
23is returned and no data is read.
24If N or iOffset is less than zero, SQLITE_ERROR is returned
25and no data is read.
26The size of the blob (and hence the maximum value of N+iOffset) can
27be determined using the
28.Fn sqlite3_blob_bytes
29interface.
30.Pp
31An attempt to read from an expired BLOB handle fails with
32an error code of SQLITE_ABORT.
33.Pp
34On success, sqlite3_blob_read() returns SQLITE_OK.
35Otherwise, an error code or an extended error code
36is returned.
37.Pp
38This routine only works on a BLOB handle which has been
39created by a prior successful call to
40.Fn sqlite3_blob_open
41and which has not been closed by
42.Fn sqlite3_blob_close .
43Passing any other pointer in to this routine results in undefined and
44probably undesirable behavior.
45.Pp
46.Sh IMPLEMENTATION NOTES
47These declarations were extracted from the
48interface documentation at line 7840.
49.Bd -literal
50SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
51.Ed
52.Sh SEE ALSO
53.Xr sqlite3_blob 3 ,
54.Xr sqlite3_blob_bytes 3 ,
55.Xr sqlite3_blob_close 3 ,
56.Xr sqlite3_blob_open 3 ,
57.Xr sqlite3_blob_write 3 ,
58.Xr SQLITE_OK 3
59