Copy up to pagesToBackup pages from source database to destination.
Copy up to pagesToBackup pages from source database to destination. If pagesToBackup is negative, all remaining pages are copied.
If source database is modified during backup by any connection other than the source connection, then the backup will be restarted by the next call to backupStep. If the source database is modified by the source connection itself, then destination database is be updated without backup restart.
the maximum number of pages to back up during this step, or negative number to back up all pages
true if the backup was finished, false if there are still pages to back up
SQLiteBusyException
if SQLite cannot establish SHARED_LOCK on the source database or RESERVED_LOCK on
the destination database or source connection is currently used to write to the database.
In these cases call to backupStep can be retried later.
SQLiteException
if SQLite returns an error or if the call violates the contract of this class
Disposes this backup instance and connection to the destination database.
Disposes this backup instance and connection to the destination database.
This is a convenience method, equivalent to dispose(true)
.
#dispose(boolean)
Dispose this backup instance and, if disposeDestination
is true, dispose the connection to
the destination database as well.
Dispose this backup instance and, if disposeDestination
is true, dispose the connection to
the destination database as well.
You might want to pass false
to this method to subsequently call #getDestinationConnection()
and perform any actions on the fresh backup of the database, then dispose it yourself.
if true, connection to the destination database will be disposed
Returns connection to the destination database, that was opened by com.almworks.sqlite4java.SQLiteConnection#initializeBackup
.
Returns connection to the destination database, that was opened by com.almworks.sqlite4java.SQLiteConnection#initializeBackup
.
Important! If you call this method, you should be careful about disposing the connection you got. You should only dispose it after disposing SQLiteBackup instance, otherwise the JVM might crash.
destination database connection
Returns the total number of pages in the source database.
Returns the total number of pages in the source database.
total number of pages to back up
SQLiteException
if called from a different thread or if source or destination connection are disposed
Returns the number of pages still to be backed up.
Returns the number of pages still to be backed up.
number of remaining pages
SQLiteException
if called from a different thread or if source or destination connection are disposed
Checks whether the backup was successfully finished.
Checks whether the backup was successfully finished.
true if last call to { @link #backupStep} has returned true.
SQLiteBackup wraps an instance of SQLite database backup, represented as
Unless a method is marked as thread-safe, it is confined to the thread that has opened the connection to the source database. Calling a confined method from a different thread will result in exception.sqlite3_backup*
in SQLite C API. Usage example:SQLiteConnection#initializeBackup
Using the SQLite Online Backup API
SQLite Online Backup API