Name

sqlite3_backup_init() — Start an online backup [EXP]

Definition

sqlite3_backup* sqlite3_backup_init(
                    sqlite3* db_dst, const char* db_name_dst,
                    sqlite3* db_src, const char* db_name_src );
db_dst

The destination database connection.

db_name_dst

The destination logical database name in UTF-8. This can be main, temp, or the name given to ATTACH DATABASE.

db_src

The source database connection. Must be different from db_dst.

db_name_src

The source logical database name in UTF-8.

Returns

An online backup handle.

Description

This function initiates an online database backup. The online backup APIs can be used to make a low-level copy of a complete database instance without locking the database. The backup APIs can be used to perform live backups, or they can be used to copy a file-backed database to an in-memory database (or vice-versa).

The application requires exclusive access to the destination database for the duration of the operation. The source database requires read-only access, but the locks are periodically released to allow other processes to continue to access and modify the source database.

To perform an online backup, a backup handle is created with sqlite3_backup_init(). The application continues to call sqlite3_backup_step() to transfer data, generally pausing for a short time between calls. Finally, sqlite3_backup_finish() is called to release the backup handle.

For more information on using the online backup APIs, see http://www.sqlite.org/backup.html.

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.