Apr 2, 2014 Replies: 11 Description: A class to manage the backup of SQLite files. It allows you to manage backup SQLite database files, set the maximum number of backups to keep, create backups at any time and with any name (with a field for an additional note) or set an automatic backup: daily, weekly or monthly. Depends on: KeyValueStore (which in turn depends on RandomAccessFile). * Note: you should declare (and initialize) a global variable named KVStore as KeyValueStore in the Process_Globals of the Main activity (or elsewhere, but in this case, you should modify the references in these sub routines: Initialize, LoadBackupMap and SaveBackupMap). Main methods: - CreateBackup(BackupName As String, Note As String) As Boolean Creates a db backup. - RestoreFromBackup(BackupName As String) As Boolean Restores the db from a backup. - DeleteBackup(BackupName As String) As Boolean Deletes a backup file. - LoadBackupMap * Gets the backup map from the KeyValueStore. - SaveBackupMap * Puts the backup map in to the KeyValueStore. - FillListView(lvw As ListView) Fills the listview passed as a parameter with the descriptive data of the backup files - ReadSettings Reads: max number of backups, Automatic state and period - SaveSettings Saves: max number of backups, Automatic state and period Properties: - MaxBackups Sets/Gets max number of backups. - BkpInfos Gets a map as follows: Backup names are the Keys; Objects of type typBkpInfo are the values. - Auto Sets/Gets the periodically automated setting ON/OFF. - AutoPeriod Sets/Gets the periodically automated period. Period can be: AUTO_DAILY, AUTO_WEEKLY, AUTO_MONTHY Type: - typBkpInfo(Created As Long, Note As String) Created: the creation date; Note: a description for the backup. [I have not tested the attached sample completely] Tags: Backup Attachments clsSQLiteBackup.zip clsSQLiteBackup.zip 3.2 KB · Views: 917 clsSQLiteBackupsTest.zip clsSQLiteBackupsTest.zip 22.1 KB · Views: 896 Last edited: May 10, 2014 Click to expand...
Description: A class to manage the backup of SQLite files. It allows you to manage backup SQLite database files, set the maximum number of backups to keep, create backups at any time and with any name (with a field for an additional note) or set an automatic backup: daily, weekly or monthly. Depends on: KeyValueStore (which in turn depends on RandomAccessFile). * Note: you should declare (and initialize) a global variable named KVStore as KeyValueStore in the Process_Globals of the Main activity (or elsewhere, but in this case, you should modify the references in these sub routines: Initialize, LoadBackupMap and SaveBackupMap). Main methods: - CreateBackup(BackupName As String, Note As String) As Boolean Creates a db backup. - RestoreFromBackup(BackupName As String) As Boolean Restores the db from a backup. - DeleteBackup(BackupName As String) As Boolean Deletes a backup file. - LoadBackupMap * Gets the backup map from the KeyValueStore. - SaveBackupMap * Puts the backup map in to the KeyValueStore. - FillListView(lvw As ListView) Fills the listview passed as a parameter with the descriptive data of the backup files - ReadSettings Reads: max number of backups, Automatic state and period - SaveSettings Saves: max number of backups, Automatic state and period Properties: - MaxBackups Sets/Gets max number of backups. - BkpInfos Gets a map as follows: Backup names are the Keys; Objects of type typBkpInfo are the values. - Auto Sets/Gets the periodically automated setting ON/OFF. - AutoPeriod Sets/Gets the periodically automated period. Period can be: AUTO_DAILY, AUTO_WEEKLY, AUTO_MONTHY Type: - typBkpInfo(Created As Long, Note As String) Created: the creation date; Note: a description for the backup. [I have not tested the attached sample completely] Tags: Backup
bl4ck4nt Member Licensed User Longtime User May 8, 2014 #2 Please give some tutorial/project to use this class SQL Backup...thanx
R rboeck Well-Known Member Licensed User Longtime User May 8, 2014 #3 Questions and ideas for backup: how can one choose a location? I think an backup in the same place like the database is only usefull for some situations like database corruption. In an app i enabled database backup to email, usb stick an sd card. Thanks.
Questions and ideas for backup: how can one choose a location? I think an backup in the same place like the database is only usefull for some situations like database corruption. In an app i enabled database backup to email, usb stick an sd card. Thanks.
LucaMs Expert Licensed User Longtime User May 8, 2014 #4 bl4ck4nt said: Please give some tutorial/project to use this class SQL Backup...thanx Click to expand... Yes, I will add a small app to test
bl4ck4nt said: Please give some tutorial/project to use this class SQL Backup...thanx Click to expand... Yes, I will add a small app to test
LucaMs Expert Licensed User Longtime User May 8, 2014 #5 rboeck said: Questions and ideas for backup: how can one choose a location? I think an backup in the same place like the database is only usefull for some situations like database corruption. In an app i enabled database backup to email, usb stick an sd card. Thanks. Click to expand... You are right, but you forgot the cases where the user accidentally deletes important data and wants to recover them.
rboeck said: Questions and ideas for backup: how can one choose a location? I think an backup in the same place like the database is only usefull for some situations like database corruption. In an app i enabled database backup to email, usb stick an sd card. Thanks. Click to expand... You are right, but you forgot the cases where the user accidentally deletes important data and wants to recover them.
LucaMs Expert Licensed User Longtime User May 10, 2014 #6 bl4ck4nt said: Please give some tutorial/project to use this class SQL Backup...thanx Click to expand... I have attached an example (not fully tested)
bl4ck4nt said: Please give some tutorial/project to use this class SQL Backup...thanx Click to expand... I have attached an example (not fully tested)
incendio Well-Known Member Licensed User Longtime User Jun 12, 2014 #7 Dear LucaMs, Thanks for this class, it is a great help for me. I have a few questions about this class : 1) About daily auto backup, when this is triggers? When class is initialized? Can this set to off? 2) Can I backup data from one device and restore it to another device? Thanks.
Dear LucaMs, Thanks for this class, it is a great help for me. I have a few questions about this class : 1) About daily auto backup, when this is triggers? When class is initialized? Can this set to off? 2) Can I backup data from one device and restore it to another device? Thanks.
LucaMs Expert Licensed User Longtime User Jun 12, 2014 #8 1) there is a routine named "ManageAuto" which is called from Inizialize. The class must be initialized at the start of the app. This routine compares the current date to the date of the last automatic backup made (the name of the automaci backup files are composed of "auto_" + ticks date) 2) This is the main problem. The class allows the backup into the device but not elsewhere. This "elsewhere", on the other hand, could be many "things". I decided I had to think of what to implement for this problem, but then I suspended. I gladly accept suggestions/changes Last edited: Jun 13, 2014
1) there is a routine named "ManageAuto" which is called from Inizialize. The class must be initialized at the start of the app. This routine compares the current date to the date of the last automatic backup made (the name of the automaci backup files are composed of "auto_" + ticks date) 2) This is the main problem. The class allows the backup into the device but not elsewhere. This "elsewhere", on the other hand, could be many "things". I decided I had to think of what to implement for this problem, but then I suspended. I gladly accept suggestions/changes
incendio Well-Known Member Licensed User Longtime User Jun 12, 2014 #9 To restore to other device, maybe, upload backup & log data to the cloud, and then on other device, download from cloud then do the restore. Just my idea
To restore to other device, maybe, upload backup & log data to the cloud, and then on other device, download from cloud then do the restore. Just my idea
LucaMs Expert Licensed User Longtime User Jun 12, 2014 #10 incendio said: To restore to other device, maybe, upload backup & log data to the cloud, and then on other device, download from cloud then do the restore. Just my idea Click to expand... Good idea. Write a routine to add to the class
incendio said: To restore to other device, maybe, upload backup & log data to the cloud, and then on other device, download from cloud then do the restore. Just my idea Click to expand... Good idea. Write a routine to add to the class
LucaMs Expert Licensed User Longtime User Jun 13, 2014 #12 incendio said: Great Click to expand... I meant: Write (you) a routine to add to the class