From 06e446a5276e4ace27d3340c8a0c65da3bf3d159 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 14 Jan 2011 20:28:29 +0000 Subject: [PATCH] Only start dummy statement when backup completes if it was running before backup. Fixes broken upgrades in 2.1b3. --- chrome/content/zotero/xpcom/db.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 135dea9258..8842231536 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -852,11 +852,14 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) { // Turn off DB locking before backup and reenable after, since otherwise // the lock is lost var dbLockExclusive = Zotero.Prefs.get('dbLockExclusive'); + var hadDummyStatement = !!this._dummyStatement; try { if (dbLockExclusive) { Zotero.DB.query("PRAGMA locking_mode=NORMAL"); } - Zotero.DB.stopDummyStatement(); + if (hadDummyStatement) { + Zotero.DB.stopDummyStatement(); + } var store = Components.classes["@mozilla.org/storage/service;1"]. getService(Components.interfaces.mozIStorageService); @@ -871,7 +874,9 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) { if (dbLockExclusive) { Zotero.DB.query("PRAGMA locking_mode=EXCLUSIVE"); } - Zotero.DB.startDummyStatement(); + if (hadDummyStatement) { + Zotero.DB.startDummyStatement(); + } } // Opened database files can't be moved on Windows, so we have to skip