Name

sqlite3_blob_open() — Create and open a BLOB handle

Definition

int sqlite3_blob_open( sqlite3* db,
        const char* db_name, const char* tbl_name, const char* col_name,
        sqlite3_int64 row_id, int flags, sqlite3_blob** blob );
db

A database connection.

db_name

A logical database name in UTF-8. This can be main, temp, or a name given to ATTACH DATABASE.

tbl_name

A table name in UTF-8.

col_name

A column name in UTF-8

row_id

A ROWID value.

flags

A nonzero value will open the BLOB read/write. A zero value will open the BLOB read-only.

blob

A reference to a BLOB handle. The new BLOB handle will be returned via this reference. The BLOB handle may be set to NULL if an error is returned.

Returns

An SQLite response code.

Description

This function creates a new BLOB handle used for incremental BLOB I/O. The parameters need to describe the BLOB referenced with the SQL statement:

SELECT col_name FROM db_name.tbl_name WHERE ROWID = row_id;

The BLOB handle remains valid until it is closed, or until it expires. A BLOB handle expires when any column of the row that contains the BLOB is modified in any way (typically by an UPDATE or DELETE). An expired BLOB handle must still be closed.

When foreign key constraints are enabled, BLOB values contained in columns that are part of a foreign key can only be opened read-only.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.