Addresses #77, maintain database backups

Temporarily added in a check of the backup file on startup, since I'm not entirely convinced that the backup mechanism on shutdown couldn't create a corrupt file under certain conditions

If you run with debug output on and notice the "Backup file was corrupt" message, let me know.
This commit is contained in:
Dan Stillman 2006-08-01 23:32:18 +00:00
parent d3bc693dab
commit 5c6d9de4b8

View file

@ -361,6 +361,18 @@ Scholar.DB = new function(){
var file = Scholar.getScholarDatabase(); var file = Scholar.getScholarDatabase();
var backupFile = Scholar.getScholarDatabase('bak'); var backupFile = Scholar.getScholarDatabase('bak');
// DEBUG: Temporary check
// Test the backup file (to make sure the backup mechanism is working)
if (backupFile.exists()){
try {
_connection = store.openDatabase(backupFile);
}
catch (e){
Scholar.debug('Backup file was corrupt', 1);
}
_connection = undefined;
}
catchBlock: try { catchBlock: try {
_connection = store.openDatabase(file); _connection = store.openDatabase(file);
} }