1.Dd January 24, 2024 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.In sqlite3.h 9.Ft int 10.Fo sqlite3_blob_write 11.Fa "sqlite3_blob *" 12.Fa "const void *z" 13.Fa "int n" 14.Fa "int iOffset" 15.Fc 16.Sh DESCRIPTION 17This function is used to write data into an open BLOB handle 18from a caller-supplied buffer. 19N bytes of data are copied from the buffer Z into the open BLOB, starting 20at offset iOffset. 21.Pp 22On success, sqlite3_blob_write() returns SQLITE_OK. 23Otherwise, an error code or an extended error code 24is returned. 25Unless SQLITE_MISUSE is returned, this function sets the database connection 26error code and message accessible via 27.Fn sqlite3_errcode 28and 29.Fn sqlite3_errmsg 30and related functions. 31.Pp 32If the BLOB handle passed as the first argument was not 33opened for writing (the flags parameter to 34.Fn sqlite3_blob_open 35was zero), this function returns SQLITE_READONLY. 36.Pp 37This function may only modify the contents of the BLOB; it is not possible 38to increase the size of a BLOB using this API. 39If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR 40is returned and no data is written. 41The size of the BLOB (and hence the maximum value of N+iOffset) can 42be determined using the 43.Fn sqlite3_blob_bytes 44interface. 45If N or iOffset are less than zero SQLITE_ERROR is returned 46and no data is written. 47.Pp 48An attempt to write to an expired BLOB handle fails with 49an error code of SQLITE_ABORT. 50Writes to the BLOB that occurred before the BLOB handle 51expired are not rolled back by the expiration of the handle, though 52of course those changes might have been overwritten by the statement 53that expired the BLOB handle or by other independent statements. 54.Pp 55This routine only works on a BLOB handle which has been 56created by a prior successful call to 57.Fn sqlite3_blob_open 58and which has not been closed by 59.Fn sqlite3_blob_close . 60Passing any other pointer in to this routine results in undefined and 61probably undesirable behavior. 62.Pp 63.Sh IMPLEMENTATION NOTES 64These declarations were extracted from the 65interface documentation at line 7869. 66.Bd -literal 67SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); 68.Ed 69.Sh SEE ALSO 70.Xr sqlite3 3 , 71.Xr sqlite3_blob 3 , 72.Xr sqlite3_blob_bytes 3 , 73.Xr sqlite3_blob_close 3 , 74.Xr sqlite3_blob_open 3 , 75.Xr sqlite3_blob_read 3 , 76.Xr sqlite3_errcode 3 , 77.Xr SQLITE_OK 3 78