Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Open A BLOB For Incremental I/O

int sqlite3_blob_open(
  sqlite3*,
  const char *zDb,
  const char *zTable,
  const char *zColumn,
  sqlite3_int64 iRow,
  int flags,
  sqlite3_blob **ppBlob
);

This interfaces opens a handle to the BLOB located in row iRow, column zColumn, table zTable in database zDb; in other words, the same BLOB that would be selected by:

SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;

If the flags parameter is non-zero, the the BLOB is opened for read and write access. If it is zero, the BLOB is opened for read access.

Note that the database name is not the filename that contains the database but rather the symbolic name of the database that is assigned when the database is connected using ATTACH. For the main database file, the database name is "main". For TEMP tables, the database name is "temp".

On success, SQLITE_OK is returned and the new BLOB handle is written to *ppBlob. Otherwise an error code is returned and any value written to *ppBlob should not be used by the caller. This function sets the database connection error code and message accessible via sqlite3_errcode() and sqlite3_errmsg().

If the row that a BLOB handle points to is modified by an UPDATE, DELETE, or by ON CONFLICT side-effects then the BLOB handle is marked as "expired". This is true if any column of the row is changed, even a column other than the one the BLOB handle is open on. Calls to sqlite3_blob_read() and sqlite3_blob_write() for a expired BLOB handle fail with an return code of SQLITE_ABORT. Changes written into a BLOB prior to the BLOB expiring are not rollback by the expiration of the BLOB. Such changes will eventually commit if the transaction continues to completion.

Requirements: H17813 H17814 H17816 H17819 H17821 H17824

See also lists of Objects, Constants, and Functions.


This page last modified 2009/02/18 18:03:35 UTC