xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_db_cacheflush.3 (revision 82d56013d7b633d116a93943de88e08335357a7c)
1.Dd December 19, 2018
2.Dt SQLITE3_DB_CACHEFLUSH 3
3.Os
4.Sh NAME
5.Nm sqlite3_db_cacheflush
6.Nd Flush caches to disk mid-transaction
7.Sh SYNOPSIS
8.Ft int
9.Fo sqlite3_db_cacheflush
10.Fa "sqlite3*"
11.Fc
12.Sh DESCRIPTION
13If a write-transaction is open on database connection
14D when the sqlite3_db_cacheflush(D) interface
15invoked, any dirty pages in the pager-cache that are not currently
16in use are written out to disk.
17A dirty page may be in use if a database cursor created by an active
18SQL statement is reading from it, or if it is page 1 of a database
19file (page 1 is always "in use").
20The sqlite3_db_cacheflush(D) interface flushes
21caches for all schemas - "main", "temp", and any attached databases.
22.Pp
23If this function needs to obtain extra database locks before dirty
24pages can be flushed to disk, it does so.
25If those locks cannot be obtained immediately and there is a busy-handler
26callback configured, it is invoked in the usual manner.
27If the required lock still cannot be obtained, then the database is
28skipped and an attempt made to flush any dirty pages belonging to the
29next (if any) database.
30If any databases are skipped because locks cannot be obtained, but
31no other error occurs, this function returns SQLITE_BUSY.
32.Pp
33If any other error occurs while flushing dirty pages to disk (for example
34an IO error or out-of-memory condition), then processing is abandoned
35and an SQLite error code is returned to the caller immediately.
36.Pp
37Otherwise, if no error occurs, sqlite3_db_cacheflush()
38returns SQLITE_OK.
39.Pp
40This function does not set the database handle error code or message
41returned by the sqlite3_errcode() and sqlite3_errmsg()
42functions.
43.Sh SEE ALSO
44.Xr sqlite3 3 ,
45.Xr sqlite3_db_cacheflush 3 ,
46.Xr sqlite3_errcode 3
47