Fixed incorrect 'this' value

This commit is contained in:
Ben Ashton 2021-03-05 13:30:56 -08:00
parent 2b495367a2
commit 52659c585e
3 changed files with 9 additions and 5 deletions

View File

@ -160,6 +160,8 @@ class QueryWrapper {
executeRun(db) {
return new Promise((resolve, reject) => {
const self = this;
(0,_log_mjs__WEBPACK_IMPORTED_MODULE_2__.log)(this.sql);
db.run(this.sql, ...this.args, function (err) {
if (err) {
@ -169,11 +171,11 @@ class QueryWrapper {
const result = {};
if (this.isAnyOf("INSERT")) {
if (self.isAnyOf("INSERT")) {
result.insertId = this.lastID;
}
if (this.isAnyOf("UPDATE", "DELETE")) {
if (self.isAnyOf("UPDATE", "DELETE")) {
result.rowsAffected = this.changes;
}

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,8 @@ export class QueryWrapper {
executeRun(db) {
return new Promise((resolve, reject) => {
const self = this;
log(this.sql);
db.run(this.sql, ...this.args, function (err) {
if (err) {
@ -38,11 +40,11 @@ export class QueryWrapper {
const result = {};
if (this.isAnyOf("INSERT")) {
if (self.isAnyOf("INSERT")) {
result.insertId = this.lastID;
}
if (this.isAnyOf("UPDATE", "DELETE")) {
if (self.isAnyOf("UPDATE", "DELETE")) {
result.rowsAffected = this.changes;
}