@bbn/bbn 1.0.382 → 1.0.383
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/db.js +16 -15
- package/package.json +1 -1
package/dist/db.js
CHANGED
|
@@ -104,23 +104,24 @@ var dbObject = function (dbName) {
|
|
|
104
104
|
var _a = getStore(table, 'w'), tx = _a[0], store = _a[1];
|
|
105
105
|
var arch = structure[table];
|
|
106
106
|
var primary = arch.keys.PRIMARY.columns.length > 1 ? arch.keys.PRIMARY.columns : arch.keys.PRIMARY.columns[0];
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
_this.selectAll(table, [], where).then(function (rows) {
|
|
108
|
+
var res = 0;
|
|
109
|
+
for (var i = 0; i < rows.length; i++) {
|
|
110
|
+
var newData = extend({}, rows[i], data);
|
|
111
|
+
log("UPDATING FROM BBN-JS", newData);
|
|
112
|
+
if (!newData[primary]) {
|
|
113
|
+
throw new Error(_("No primary key in the data"));
|
|
114
|
+
}
|
|
115
|
+
var req = store.put(newData);
|
|
116
|
+
onError(req, resolve);
|
|
117
|
+
req.onsuccess = function () {
|
|
118
|
+
res++;
|
|
119
|
+
};
|
|
114
120
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
req.onsuccess = function () {
|
|
118
|
-
res++;
|
|
121
|
+
tx.oncomplete = function () {
|
|
122
|
+
resolve(res);
|
|
119
123
|
};
|
|
120
|
-
}
|
|
121
|
-
tx.oncomplete = function () {
|
|
122
|
-
resolve(res);
|
|
123
|
-
};
|
|
124
|
+
});
|
|
124
125
|
});
|
|
125
126
|
};
|
|
126
127
|
this.delete = function (table, where) {
|