Fix error from f3b461ae1d when no duplicate items found

This commit is contained in:
Dan Stillman 2017-06-20 05:58:12 -04:00
parent 041f79379c
commit 3259b63081

View File

@ -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;