@dwtechs/antity-pgsql 0.6.0 → 0.6.1
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/antity-pgsql.js +4 -6
- package/package.json +1 -1
package/dist/antity-pgsql.js
CHANGED
|
@@ -314,16 +314,14 @@ class Update {
|
|
|
314
314
|
this._props = [];
|
|
315
315
|
}
|
|
316
316
|
addProp(prop) {
|
|
317
|
-
this._props.push(
|
|
317
|
+
this._props.push(prop);
|
|
318
318
|
}
|
|
319
319
|
query(table, rows, consumerId, consumerName) {
|
|
320
|
-
if (consumerId !== undefined && consumerName !== undefined)
|
|
320
|
+
if (consumerId !== undefined && consumerName !== undefined)
|
|
321
321
|
rows = this.addConsumer(rows, consumerId, consumerName);
|
|
322
|
-
}
|
|
323
322
|
const propsToUse = [...this._props];
|
|
324
|
-
if (consumerId !== undefined && consumerName !== undefined)
|
|
323
|
+
if (consumerId !== undefined && consumerName !== undefined)
|
|
325
324
|
propsToUse.push("consumerId", "consumerName");
|
|
326
|
-
}
|
|
327
325
|
const l = rows.length;
|
|
328
326
|
const args = rows.map(row => row.id);
|
|
329
327
|
let query = `UPDATE "${quoteIfUppercase(table)}" SET `;
|
|
@@ -331,7 +329,7 @@ class Update {
|
|
|
331
329
|
for (const p of propsToUse) {
|
|
332
330
|
if (rows[0][p] === undefined)
|
|
333
331
|
continue;
|
|
334
|
-
query += `${p} = CASE `;
|
|
332
|
+
query += `${quoteIfUppercase(p)} = CASE `;
|
|
335
333
|
for (let j = 0; j < l; j++) {
|
|
336
334
|
const row = rows[j];
|
|
337
335
|
query += `WHEN id = $${j + 1} THEN $${i++} `;
|