Name
sqlite3_backup_step() — Continue an online backup [EXP]
Definition
int sqlite3_backup_step( sqlite3_backup* backup, int pages );
-
backup
An online backup handle.
-
pages
The number of pages to copy. If this value is negative, all remaining pages are copied.
- Returns
An SQLite result code.
SQLITE_OK
indicates the pages were successfully copied, but more pages remain.SQLITE_DONE
indicates that a complete backup was made. Ifsqlite3_
backup_
step()
returnsSQLITE_BUSY
orSQLITE_LOCKED
, the function can be safely retried at a later time.
Description
This function attempts to copy the specified number of pages
from the source database to the destination database. A shared
read lock is obtained and then released on the source database
for each call to sqlite3_backup_step()
. Larger page counts
finish the backup more quickly, while smaller page counts allow
more concurrent access.
Modifications made to the source database through the same database connection that is being used for the backup are automatically reflected into the destination database, allowing the online backup to continue.
Modifications made to the source database through any other
database connection will cause the backup to reset and start
over. This is transparent. If an application is attempting to
back up a highly dynamic database it should call sqlite3_backup_step()
very
frequently and use a very large page count, or it risks
continual reset. This could result in the backup perpetually
failing to complete.
See Also
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.