Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Write Data Into A BLOB Incrementally

int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);

This function is used to write data into an open blob-handle from a user supplied buffer. n bytes of data are copied from the buffer pointed to by z into the open blob, starting at offset iOffset.

If the blob-handle passed as the first argument was not opened for writing (the flags parameter to sqlite3_blob_open() was zero), this function returns SQLITE_READONLY.

This function may only modify the contents of the blob; it is not possible to increase the size of a blob using this API. If offset iOffset is less than n bytes from the end of the blob, SQLITE_ERROR is returned and no data is written. If n is less than zero SQLITE_ERROR is returned and no data is written.

On success, SQLITE_OK is returned. Otherwise, an error code or an extended error code is returned.

Invariants:

F17873 The sqlite3_blob_write(P,Z,N,X) interface writes N bytes from buffer Z into the blob that sqlite3_blob object P refers to beginning at an offset of X into the blob.
F17875 The sqlite3_blob_write(P,Z,N,X) interface returns SQLITE_READONLY if the sqlite3_blob object P was opened for reading only.
F17876 In sqlite3_blob_write(P,Z,N,X) if the size of the blob is less than N+X bytes, then the function returns SQLITE_ERROR and nothing is written into the blob.
F17879 In sqlite3_blob_write(P,Z,N,X) if X or N is less than zero then the function returns SQLITE_ERROR and nothing is written into the blob.
F17882 The sqlite3_blob_write(P,Z,N,X) interface returns SQLITE_OK if N bytes where successfully written into blob.
F17885 If the requested write could not be completed, the sqlite3_blob_write(P,Z,N,X) interface returns an appropriate error code or extended error code.
F17888 If an error occurs during evaluation of sqlite3_blob_write(D,...) then subsequent calls to sqlite3_errcode(D), sqlite3_errmsg(D), and sqlite3_errmsg16(D) will return information approprate for that error.

See also lists of Objects, Constants, and Functions.


This page last modified 2008/05/12 13:08:44 UTC