Small. Fast. Reliable.
Choose any three.
Search for:

SQLite C Interface

Recover snapshots from a wal file

int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);

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

If all connections disconnect from a database file but do not perform a checkpoint, the existing wal file is opened along with the database file the next time the database is opened. At this point it is only possible to successfully call sqlite3_snapshot_open() to open the most recent snapshot of the database (the one at the head of the wal file), even though the wal file may contain other valid snapshots for which clients have sqlite3_snapshot handles.

This function attempts to scan the wal file associated with database zDb of database handle db and make all valid snapshots available to sqlite3_snapshot_open(). It is an error if there is already a read transaction open on the database, or if the database is not a wal mode database.

SQLITE_OK is returned if successful, or an SQLite error code otherwise.

See also lists of Objects, Constants, and Functions.