Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Read Data From A BLOB Incrementally

int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);

R-08195-21952:[This function is used to read data from an open BLOB handle into a caller-supplied buffer. N bytes of data are copied into buffer Z from the open BLOB, starting at offset iOffset. ]

R-42401-19613:[If offset iOffset is less than N bytes from the end of the BLOB, SQLITE_ERROR is returned and no data is read. ] R-35711-48727:[If N or iOffset is less than zero, SQLITE_ERROR is returned and no data is read. ] R-23027-35758:[The size of the blob (and hence the maximum value of N+iOffset) can be determined using the sqlite3_blob_bytes() interface. ]

R-29082-45770:[An attempt to read from an expired BLOB handle fails with an error code of SQLITE_ABORT. ]

R-10893-13770:[On success, sqlite3_blob_read() returns SQLITE_OK. Otherwise, an error code or an extended error code is returned. ]

This routine only works on a BLOB handle which has been created by a prior successful call to sqlite3_blob_open() and which has not been closed by sqlite3_blob_close(). Passing any other pointer in to this routine results in undefined and probably undesirable behavior.

See also: sqlite3_blob_write().

See also lists of Objects, Constants, and Functions.