SQLITE3_SNAPSHOT_RECOVER(3)

SQLITE3_SNAPSHOT_RECOVER(3) | Library Functions Manual | SQLITE3_SNAPSHOT_RECOVER(3)

# NAME

`sqlite3_snapshot_recover` —
Recover snapshots from a wal file

# SYNOPSIS

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

# DESCRIPTION

If a WAL file remains on disk after all database connections close (either through the use of the SQLITE_FCNTL_PERSIST_WAL file control or because the last process to have the database opened exited without calling sqlite3_close()) and a new connection is subsequently opened on that database and WAL file, the sqlite3_snapshot_open() interface will only be able to open the last transaction added to the WAL file even though the WAL file contains other valid transactions.

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.

This interface is only available if SQLite is compiled with the SQLITE_ENABLE_SNAPSHOT option.

# SEE ALSO

sqlite3_file_control(3), sqlite3_close(3), sqlite3_snapshot_open(3), SQLITE_FCNTL_LOCKSTATE(3)

December 19, 2018 | NetBSD 9.0