pg-mvc-service 1.0.27 → 1.0.28
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.
|
@@ -17,7 +17,7 @@ class WhereExpression {
|
|
|
17
17
|
}
|
|
18
18
|
ValidateValueUtil_1.default.validateValue(column, pk[keyColumn]);
|
|
19
19
|
newVars.push(pk[keyColumn]);
|
|
20
|
-
conditions.push(
|
|
20
|
+
conditions.push(`${isSetAlias ? `"${model.TableAlias}".` : ''}${keyColumn} = $${newVars.length}`);
|
|
21
21
|
}
|
|
22
22
|
return {
|
|
23
23
|
expression: conditions.join(' AND '),
|
|
@@ -553,7 +553,7 @@ class TableModel {
|
|
|
553
553
|
yield this.validateUpdate(options);
|
|
554
554
|
const updateSetQuery = UpdateExpression_1.default.createUpdateSet(this, options);
|
|
555
555
|
const whereQuery = WhereExpression_1.default.createConditionPk(this, { id: id }, updateSetQuery.vars);
|
|
556
|
-
const sql = updateSetQuery.expression + ' ' + whereQuery.expression;
|
|
556
|
+
const sql = updateSetQuery.expression + ' WHERE ' + whereQuery.expression;
|
|
557
557
|
const data = yield this.executeQuery(sql, whereQuery.vars);
|
|
558
558
|
if (data.rowCount !== 1) {
|
|
559
559
|
throw new Exception_1.UnprocessableException("201", this.errorMessages.find.replace('{pks}', ((_a = whereQuery.vars) !== null && _a !== void 0 ? _a : []).join(',')));
|
|
@@ -568,7 +568,7 @@ class TableModel {
|
|
|
568
568
|
yield this.validateUpdate(options);
|
|
569
569
|
const updateSetQuery = UpdateExpression_1.default.createUpdateSet(this, options);
|
|
570
570
|
const whereQuery = WhereExpression_1.default.createConditionPk(this, pk, updateSetQuery.vars);
|
|
571
|
-
const sql = updateSetQuery.expression + ' ' + whereQuery.expression;
|
|
571
|
+
const sql = updateSetQuery.expression + ' WHERE ' + whereQuery.expression;
|
|
572
572
|
const data = yield this.executeQuery(sql, whereQuery.vars);
|
|
573
573
|
if (data.rowCount !== 1) {
|
|
574
574
|
throw new Exception_1.UnprocessableException("401", this.errorMessages.find.replace('{pks}', ((_a = whereQuery.vars) !== null && _a !== void 0 ? _a : []).join(',')));
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export default class WhereExpression {
|
|
|
19
19
|
|
|
20
20
|
ValidateValueUtil.validateValue(column, pk[keyColumn]);
|
|
21
21
|
newVars.push(pk[keyColumn]);
|
|
22
|
-
conditions.push(
|
|
22
|
+
conditions.push(`${isSetAlias ? `"${model.TableAlias}".` : ''}${keyColumn} = $${newVars.length}`);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return {
|
package/src/models/TableModel.ts
CHANGED
|
@@ -621,7 +621,7 @@ export class TableModel {
|
|
|
621
621
|
const updateSetQuery = UpdateExpression.createUpdateSet(this, options);
|
|
622
622
|
const whereQuery = WhereExpression.createConditionPk(this, {id: id}, updateSetQuery.vars);
|
|
623
623
|
|
|
624
|
-
const sql = updateSetQuery.expression + ' ' + whereQuery.expression;
|
|
624
|
+
const sql = updateSetQuery.expression + ' WHERE ' + whereQuery.expression;
|
|
625
625
|
|
|
626
626
|
const data = await this.executeQuery(sql, whereQuery.vars);
|
|
627
627
|
if (data.rowCount !== 1) {
|
|
@@ -637,7 +637,7 @@ export class TableModel {
|
|
|
637
637
|
const updateSetQuery = UpdateExpression.createUpdateSet(this, options);
|
|
638
638
|
const whereQuery = WhereExpression.createConditionPk(this, pk, updateSetQuery.vars);
|
|
639
639
|
|
|
640
|
-
const sql = updateSetQuery.expression + ' ' + whereQuery.expression;
|
|
640
|
+
const sql = updateSetQuery.expression + ' WHERE ' + whereQuery.expression;
|
|
641
641
|
|
|
642
642
|
const data = await this.executeQuery(sql, whereQuery.vars);
|
|
643
643
|
if (data.rowCount !== 1) {
|