xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_wal_autocheckpoint.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_WAL_AUTOCHECKPOINT 3
3.Os
4.Sh NAME
5.Nm sqlite3_wal_autocheckpoint
6.Nd configure an auto-checkpoint
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3_wal_autocheckpoint
11.Fa "sqlite3 *db"
12.Fa "int N"
13.Fc
14.Sh DESCRIPTION
15The sqlite3_wal_autocheckpoint(D,N)
16is a wrapper around
17.Fn sqlite3_wal_hook
18that causes any database on database connection
19D to automatically checkpoint after committing a transaction
20if there are N or more frames in the write-ahead log
21file.
22Passing zero or a negative value as the nFrame parameter disables automatic
23checkpoints entirely.
24.Pp
25The callback registered by this function replaces any existing callback
26registered using
27.Fn sqlite3_wal_hook .
28Likewise, registering a callback using
29.Fn sqlite3_wal_hook
30disables the automatic checkpoint mechanism configured by this function.
31.Pp
32The wal_autocheckpoint pragma can be used
33to invoke this interface from SQL.
34.Pp
35Checkpoints initiated by this mechanism are PASSIVE.
36.Pp
37Every new database connection defaults to having
38the auto-checkpoint enabled with a threshold of 1000 or SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
39pages.
40The use of this interface is only necessary if the default setting
41is found to be suboptimal for a particular application.
42.Sh IMPLEMENTATION NOTES
43These declarations were extracted from the
44interface documentation at line 9553.
45.Bd -literal
46SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
47.Ed
48.Sh SEE ALSO
49.Xr sqlite3 3 ,
50.Xr sqlite3_wal_checkpoint_v2 3 ,
51.Xr sqlite3_wal_hook 3
52