Fixed incorrect 'this' value
This commit is contained in:
parent
2b495367a2
commit
52659c585e
@ -160,6 +160,8 @@ class QueryWrapper {
|
|||||||
|
|
||||||
executeRun(db) {
|
executeRun(db) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
(0,_log_mjs__WEBPACK_IMPORTED_MODULE_2__.log)(this.sql);
|
(0,_log_mjs__WEBPACK_IMPORTED_MODULE_2__.log)(this.sql);
|
||||||
db.run(this.sql, ...this.args, function (err) {
|
db.run(this.sql, ...this.args, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -169,11 +171,11 @@ class QueryWrapper {
|
|||||||
|
|
||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
if (this.isAnyOf("INSERT")) {
|
if (self.isAnyOf("INSERT")) {
|
||||||
result.insertId = this.lastID;
|
result.insertId = this.lastID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAnyOf("UPDATE", "DELETE")) {
|
if (self.isAnyOf("UPDATE", "DELETE")) {
|
||||||
result.rowsAffected = this.changes;
|
result.rowsAffected = this.changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -29,6 +29,8 @@ export class QueryWrapper {
|
|||||||
|
|
||||||
executeRun(db) {
|
executeRun(db) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
log(this.sql);
|
log(this.sql);
|
||||||
db.run(this.sql, ...this.args, function (err) {
|
db.run(this.sql, ...this.args, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -38,11 +40,11 @@ export class QueryWrapper {
|
|||||||
|
|
||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
if (this.isAnyOf("INSERT")) {
|
if (self.isAnyOf("INSERT")) {
|
||||||
result.insertId = this.lastID;
|
result.insertId = this.lastID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAnyOf("UPDATE", "DELETE")) {
|
if (self.isAnyOf("UPDATE", "DELETE")) {
|
||||||
result.rowsAffected = this.changes;
|
result.rowsAffected = this.changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user