Merge pull request #66 from lae/fix/bulk-import-failure
Import terms with transactional adds instead of bulkAdd
This commit is contained in:
commit
9be66c7e7b
@ -189,20 +189,19 @@ class Database {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const termsLoaded = (title, entries, total, current) => {
|
const termsLoaded = (title, entries, total, current) => {
|
||||||
const rows = [];
|
return this.db.transaction('rw', this.db.terms, function() {
|
||||||
for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
|
for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
|
||||||
rows.push({
|
this.db.terms.add({
|
||||||
expression,
|
expression,
|
||||||
reading,
|
reading,
|
||||||
tags,
|
tags,
|
||||||
rules,
|
rules,
|
||||||
score,
|
score,
|
||||||
glossary,
|
glossary,
|
||||||
dictionary: title
|
dictionary: title
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).then(() => {
|
||||||
return this.db.terms.bulkAdd(rows).then(() => {
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(total, current);
|
callback(total, current);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user