From Xojo Documentation

Revision as of 16:57, 14 February 2013 by PLefebvre (talk | contribs) (Created page with '<ShowIf version=2013r1> {{MethodBox | name=Backup | owner=SQLiteDatabase | ownertype=class | scope=public | parameters=destination As SQLiteDatabase, callbackHandler As [[SQL…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!


SQLiteDatabase.Backup(destination As SQLiteDatabase, callbackHandler As SQLiteBackupInterface = Nil, sleepTimeInMilliseconds As Integer = 10)

Supported for all project types and targets.

Backs up the database asynchronously or synchronously. You must be connected to the destination database and its original contents (if any) will be overwritten by the backup.


The backup works asynchronously by default, to receive feedback implement the SQLiteBackupInterface and supply it as the callbackHandler. The sleepTimeInMilliseconds is used to control how often chunks of data are backed up. Increase it to backup less frequently, making your app more responsive.

If you prefer this to work synchronously supply a sleepTimeInMilliseconds of -1. Your app will stop at the backup command and wait for the backup to complete.

You can also use the Backup command to copy an in-memory database to disk.


Back up a previously connected database synchronously. This means you app will pause and wait for the backup to finish:

Dim backupDBFile As FolderItem = GetOpenFolderItem("")

If backupDBFile <> Nil Then
Dim backupDB As New SQLiteDatabase
backupDB.DatabaseFile = backupDBFile
If backupDB.CreateDatabase Then
db.Backup(backupDB, Nil, -1)
MsgBox("Backup finished!")
End If
End If

See Also