xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_snapshot_cmp.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_SNAPSHOT_CMP 3
3.Os
4.Sh NAME
5.Nm sqlite3_snapshot_cmp
6.Nd compare the ages of two snapshot handles
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3_snapshot_cmp
11.Fa "sqlite3_snapshot *p1"
12.Fa "sqlite3_snapshot *p2"
13.Fc
14.Sh DESCRIPTION
15The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages
16of two valid snapshot handles.
17.Pp
18If the two snapshot handles are not associated with the same database
19file, the result of the comparison is undefined.
20.Pp
21Additionally, the result of the comparison is only valid if both of
22the snapshot handles were obtained by calling sqlite3_snapshot_get()
23since the last time the wal file was deleted.
24The wal file is deleted when the database is changed back to rollback
25mode or when the number of database clients drops to zero.
26If either snapshot handle was obtained before the wal file was last
27deleted, the value returned by this function is undefined.
28.Pp
29Otherwise, this API returns a negative value if P1 refers to an older
30snapshot than P2, zero if the two handles refer to the same database
31snapshot, and a positive value if P1 is a newer snapshot than P2.
32.Pp
33This interface is only available if SQLite is compiled with the SQLITE_ENABLE_SNAPSHOT
34option.
35.Sh IMPLEMENTATION NOTES
36These declarations were extracted from the
37interface documentation at line 10581.
38.Bd -literal
39SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
40  sqlite3_snapshot *p1,
41  sqlite3_snapshot *p2
42);
43.Ed
44