From c9e4b7083ecb721386c36723c989da6e41b1e168 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 25 Jun 2008 00:21:37 +0000 Subject: [PATCH] Add extensions.zotero.dbLockExclusive pref to control SQLite exclusive locking (default true) Set to false to allow external access while Firefox is running --- chrome/content/zotero/xpcom/db.js | 10 ++++++++-- defaults/preferences/zotero.js | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 93c9e3263..4e6b86ef8 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -942,8 +942,14 @@ Zotero.DBConnection.prototype._getDBConnection = function () { throw (e); } - // Get exclusive lock on DB - Zotero.DB.query("PRAGMA locking_mode=EXCLUSIVE"); + // Exclusive locking mode (default) prevents access to Zotero database + // while Firefox is open -- normal mode is more convenient for development + if (Zotero.Prefs.get('dbLockExclusive')) { + Zotero.DB.query("PRAGMA locking_mode=EXCLUSIVE"); + } + else { + Zotero.DB.query("PRAGMA locking_mode=NORMAL"); + } // Register shutdown handler to call this.observe() for DB backup var observerService = Components.classes["@mozilla.org/observer-service;1"] diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 54be5e3d5..7bda721c0 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -6,6 +6,7 @@ pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zoter pref("extensions.zotero.useDataDir", false); pref("extensions.zotero.dataDir", ''); pref("extensions.zotero.lastDataDir", ''); +pref("extensions.zotero.dbLockExclusive", true); pref("extensions.zotero.debug.log",false); pref("extensions.zotero.debug.level",5); pref("extensions.zotero.debug.time", false);