1.Dd January 24, 2024 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.In sqlite3.h 9.Ft int 10.Fo sqlite3_db_cacheflush 11.Fa "sqlite3*" 12.Fc 13.Sh DESCRIPTION 14If a write-transaction is open on database connection 15D when the sqlite3_db_cacheflush(D) interface 16invoked, any dirty pages in the pager-cache that are not currently 17in use are written out to disk. 18A dirty page may be in use if a database cursor created by an active 19SQL statement is reading from it, or if it is page 1 of a database 20file (page 1 is always "in use"). 21The sqlite3_db_cacheflush(D) interface flushes 22caches for all schemas - "main", "temp", and any attached databases. 23.Pp 24If this function needs to obtain extra database locks before dirty 25pages can be flushed to disk, it does so. 26If those locks cannot be obtained immediately and there is a busy-handler 27callback configured, it is invoked in the usual manner. 28If the required lock still cannot be obtained, then the database is 29skipped and an attempt made to flush any dirty pages belonging to the 30next (if any) database. 31If any databases are skipped because locks cannot be obtained, but 32no other error occurs, this function returns SQLITE_BUSY. 33.Pp 34If any other error occurs while flushing dirty pages to disk (for example 35an IO error or out-of-memory condition), then processing is abandoned 36and an SQLite error code is returned to the caller immediately. 37.Pp 38Otherwise, if no error occurs, 39.Fn sqlite3_db_cacheflush 40returns SQLITE_OK. 41.Pp 42This function does not set the database handle error code or message 43returned by the 44.Fn sqlite3_errcode 45and 46.Fn sqlite3_errmsg 47functions. 48.Sh IMPLEMENTATION NOTES 49These declarations were extracted from the 50interface documentation at line 10283. 51.Bd -literal 52SQLITE_API int sqlite3_db_cacheflush(sqlite3*); 53.Ed 54.Sh SEE ALSO 55.Xr sqlite3 3 , 56.Xr sqlite3_errcode 3 57