Home | History | Annotate | Line # | Download | only in man
      1 .Dd April 29, 2026
      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
     17 This function is used to write data into an open BLOB handle
     18 from a caller-supplied buffer.
     19 N bytes of data are copied from the buffer Z into the open BLOB, starting
     20 at offset iOffset.
     21 .Pp
     22 On success, sqlite3_blob_write() returns SQLITE_OK.
     23 Otherwise, an error code or an extended error code
     24 is returned.
     25 Unless SQLITE_MISUSE is returned, this function sets the database connection
     26 error code and message accessible via
     27 .Fn sqlite3_errcode
     28 and
     29 .Fn sqlite3_errmsg
     30 and related functions.
     31 .Pp
     32 If the BLOB handle passed as the first argument was not
     33 opened for writing (the flags parameter to
     34 .Fn sqlite3_blob_open
     35 was zero), this function returns SQLITE_READONLY.
     36 .Pp
     37 This function may only modify the contents of the BLOB; it is not possible
     38 to increase the size of a BLOB using this API.
     39 If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR
     40 is returned and no data is written.
     41 The size of the BLOB (and hence the maximum value of N+iOffset) can
     42 be determined using the
     43 .Fn sqlite3_blob_bytes
     44 interface.
     45 If N or iOffset are less than zero SQLITE_ERROR is returned
     46 and no data is written.
     47 .Pp
     48 An attempt to write to an expired BLOB handle fails with
     49 an error code of SQLITE_ABORT.
     50 Writes to the BLOB that occurred before the BLOB handle
     51 expired are not rolled back by the expiration of the handle, though
     52 of course those changes might have been overwritten by the statement
     53 that expired the BLOB handle or by other independent statements.
     54 .Pp
     55 This routine only works on a BLOB handle which has been
     56 created by a prior successful call to
     57 .Fn sqlite3_blob_open
     58 and which has not been closed by
     59 .Fn sqlite3_blob_close .
     60 Passing any other pointer in to this routine results in undefined and
     61 probably undesirable behavior.
     62 .Pp
     63 .Sh IMPLEMENTATION NOTES
     64 These declarations were extracted from the
     65 interface documentation at line 8269.
     66 .Bd -literal
     67 SQLITE_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