1.Dd December 19, 2018 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 21On success, sqlite3_blob_write() returns SQLITE_OK. 22Otherwise, an error code or an extended error code 23is returned. 24Unless SQLITE_MISUSE is returned, this function sets the database connection 25error code and message accessible via sqlite3_errcode() 26and sqlite3_errmsg() and related functions. 27.Pp 28If the BLOB handle passed as the first argument was not 29opened for writing (the flags parameter to sqlite3_blob_open() 30was zero), this function returns SQLITE_READONLY. 31.Pp 32This function may only modify the contents of the BLOB; it is not possible 33to increase the size of a BLOB using this API. 34If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR 35is returned and no data is written. 36The size of the BLOB (and hence the maximum value of N+iOffset) can 37be determined using the sqlite3_blob_bytes() interface. 38If N or iOffset are less than zero SQLITE_ERROR is returned 39and no data is written. 40.Pp 41An attempt to write to an expired BLOB handle fails with 42an error code of SQLITE_ABORT. 43Writes to the BLOB that occurred before the BLOB handle 44expired are not rolled back by the expiration of the handle, though 45of course those changes might have been overwritten by the statement 46that expired the BLOB handle or by other independent statements. 47.Pp 48This routine only works on a BLOB handle which has been 49created by a prior successful call to sqlite3_blob_open() 50and which has not been closed by sqlite3_blob_close(). 51Passing any other pointer in to this routine results in undefined and 52probably undesirable behavior. 53.Pp 54.Sh SEE ALSO 55.Xr sqlite3_blob 3 , 56.Xr sqlite3 3 , 57.Xr sqlite3_blob_bytes 3 , 58.Xr sqlite3_blob_close 3 , 59.Xr sqlite3_blob_open 3 , 60.Xr sqlite3_blob_read 3 , 61.Xr sqlite3_errcode 3 , 62.Xr SQLITE_OK 3 63