xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_blob_write.3 (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1.Dd $Mdocdate$
2.Dt SQLITE3_BLOB_WRITE 3
3.Os
4.Sh NAME
5.Nm sqlite3_blob_write
6.Nd Write Data Into A BLOB Incrementally
7.Sh SYNOPSIS
8.Ft int
9.Fo sqlite3_blob_write
10.Fa "sqlite3_blob *"
11.Fa "const void *z"
12.Fa "int n"
13.Fa "int iOffset"
14.Fc
15.Sh DESCRIPTION
16This function is used to write data into an open BLOB handle
17from a caller-supplied buffer.
18N bytes of data are copied from the buffer Z into the open BLOB, starting
19at offset iOffset.
20.Pp
21If the BLOB handle passed as the first argument was not
22opened for writing (the flags parameter to sqlite3_blob_open()
23was zero), this function returns SQLITE_READONLY.
24.Pp
25This function may only modify the contents of the BLOB; it is not possible
26to increase the size of a BLOB using this API.
27If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR
28is returned and no data is written.
29If N is less than zero SQLITE_ERROR is returned and no
30data is written.
31The size of the BLOB (and hence the maximum value of N+iOffset) can
32be determined using the sqlite3_blob_bytes() interface.
33.Pp
34An attempt to write to an expired BLOB handle fails with
35an error code of SQLITE_ABORT.
36Writes to the BLOB that occurred before the BLOB handle
37expired are not rolled back by the expiration of the handle, though
38of course those changes might have been overwritten by the statement
39that expired the BLOB handle or by other independent statements.
40.Pp
41On success, sqlite3_blob_write() returns SQLITE_OK.
42Otherwise, an  error code or an extended error code
43is returned.
44.Pp
45This routine only works on a BLOB handle which has been
46created by a prior successful call to sqlite3_blob_open()
47and which has not been closed by sqlite3_blob_close().
48Passing any other pointer in to this routine results in undefined and
49probably undesirable behavior.
50.Pp
51.Sh SEE ALSO
52.Xr sqlite3_blob 3 ,
53.Xr SQLITE_OK 3 ,
54.Xr SQLITE_IOERR_READ 3 ,
55.Xr sqlite3_blob_bytes 3 ,
56.Xr sqlite3_blob_close 3 ,
57.Xr sqlite3_blob_open 3 ,
58.Xr sqlite3_blob_read 3 ,
59.Xr SQLITE_OK 3
60