xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_snapshot_recover.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_SNAPSHOT_RECOVER 3
3.Os
4.Sh NAME
5.Nm sqlite3_snapshot_recover
6.Nd recover snapshots from a wal file
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3_snapshot_recover
11.Fa "sqlite3 *db"
12.Fa "const char *zDb"
13.Fc
14.Sh DESCRIPTION
15If a WAL file remains on disk after all database connections
16close (either through the use of the SQLITE_FCNTL_PERSIST_WAL
17file control or because the last process to have the database
18opened exited without calling
19.Fn sqlite3_close )
20and a new connection is subsequently opened on that database and WAL file,
21the
22.Fn sqlite3_snapshot_open
23interface will only be able to open the last transaction added to the
24WAL file even though the WAL file contains other valid transactions.
25.Pp
26This function attempts to scan the WAL file associated with database
27zDb of database handle db and make all valid snapshots available to
28sqlite3_snapshot_open().
29It is an error if there is already a read transaction open on the database,
30or if the database is not a WAL mode database.
31.Pp
32SQLITE_OK is returned if successful, or an SQLite error code otherwise.
33.Pp
34This interface is only available if SQLite is compiled with the SQLITE_ENABLE_SNAPSHOT
35option.
36.Sh IMPLEMENTATION NOTES
37These declarations were extracted from the
38interface documentation at line 10611.
39.Bd -literal
40SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
41.Ed
42.Sh SEE ALSO
43.Xr sqlite3_close 3 ,
44.Xr sqlite3_file_control 3 ,
45.Xr sqlite3_snapshot_open 3 ,
46.Xr SQLITE_FCNTL_LOCKSTATE 3
47