Small. Fast. Reliable.
Choose any three.

About Documentation Download License Support Purchase |

## SQLite C Interface

## Start a read transaction on an historical snapshot

>     int sqlite3_snapshot_open(
>       sqlite3 *db,
>       const char *zSchema,
>       sqlite3_snapshot *pSnapshot
>     );

Important: This interface is experimental and is subject to change without notice.

The sqlite3_snapshot_open(D,S,P) interface attempts to move the read transaction that is currently open on schema S of database connection D so that it refers to historical snapshot P. The sqlite3_snapshot_open() interface returns SQLITE_OK on success or an appropriate error code if it fails.

In order to succeed, a call to sqlite3_snapshot_open(D,S,P) must be the first operation, apart from other sqlite3_snapshot_open() calls, following the BEGIN that starts a new read transaction. A snapshot will fail to open if it has been overwritten by a checkpoint. A snapshot will fail to open if the database connection D has not previously completed at least one read operation against the database file. (Hint: Run "PRAGMA application_id" against a newly opened database connection in order to make it ready to use snapshots.)

The sqlite3_snapshot_open() interface is only available when the SQLITE_ENABLE_SNAPSHOT compile-time option is used.

See also lists of Objects, Constants, and Functions.