From b4320fbc4cbb4ecf623c8a378760e1ee20d5f5d2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 21 Jun 2020 05:21:48 -0400 Subject: [PATCH] Add Zotero.DB.quickCheck(), and speed up integrityCheck() https://www.sqlite.org/pragma.html#pragma_quick_check And limit both checks to 1 error (e.g., integrity_check(1)) --- chrome/content/zotero/xpcom/db.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 18f4dc71fd..240e7cbb50 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -857,8 +857,14 @@ Zotero.DBConnection.prototype.info = Zotero.Promise.coroutine(function* () { }); +Zotero.DBConnection.prototype.quickCheck = async function () { + var ok = await this.valueQueryAsync("PRAGMA quick_check(1)"); + return ok == 'ok'; +}; + + Zotero.DBConnection.prototype.integrityCheck = Zotero.Promise.coroutine(function* () { - var ok = yield this.valueQueryAsync("PRAGMA integrity_check"); + var ok = yield this.valueQueryAsync("PRAGMA integrity_check(1)"); return ok == 'ok'; });