commit 3259b63081bc2e88d6b142a16601c9b75f798845
parent 041f79379cf423c53073ab13911e1e313390f098
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 20 Jun 2017 05:58:12 -0400
Fix error from f3b461ae1d when no duplicate items found
Diffstat:
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero/xpcom/duplicates.js b/chrome/content/zotero/xpcom/duplicates.js
@@ -56,17 +56,22 @@ Zotero.Duplicates.prototype.getSearchObject = async function () {
var sql = `CREATE TEMPORARY TABLE ${table} (id INTEGER PRIMARY KEY)`;
await Zotero.DB.queryAsync(sql);
- Zotero.debug("Inserting rows into temp table");
- sql = `INSERT INTO ${table} VALUES `;
- await Zotero.Utilities.Internal.forEachChunkAsync(
- ids,
- Zotero.DB.MAX_BOUND_PARAMETERS,
- async function (chunk) {
- let idStr = '(' + chunk.join('), (') + ')';
- await Zotero.DB.queryAsync(sql + idStr, false, { debug: false });
- }
- );
- Zotero.debug("Done");
+ if (ids.length) {
+ Zotero.debug("Inserting rows into temp table");
+ sql = `INSERT INTO ${table} VALUES `;
+ await Zotero.Utilities.Internal.forEachChunkAsync(
+ ids,
+ Zotero.DB.MAX_BOUND_PARAMETERS,
+ async function (chunk) {
+ let idStr = '(' + chunk.join('), (') + ')';
+ await Zotero.DB.queryAsync(sql + idStr, false, { debug: false });
+ }
+ );
+ Zotero.debug("Done");
+ }
+ else {
+ Zotero.debug("No duplicates found");
+ }
var s = new Zotero.Search;
s.libraryID = this._libraryID;