Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getPatchedDialect() {
const dialect = require('knex/lib/dialects/sqlite3/index.js');
const processResponse = dialect.prototype.processResponse;
dialect.prototype.processResponse = (obj: any, runner: any) => {
if (obj.method === 'raw' && obj.sql.trim().match('^insert into|update|delete')) {
return obj.context;
}
return processResponse(obj, runner);
};
dialect.prototype._query = (connection: any, obj: any) => {
const callMethod = this.getCallMethod(obj);
return new Bluebird((resolve: any, reject: any) => {
/* istanbul ignore if */
if (!connection || !connection[callMethod]) {
return reject(new Error(`Error calling ${callMethod} on connection.`));
}
private getPatchedDialect() {
const dialect = require('knex/lib/dialects/sqlite3/index.js');
const processResponse = dialect.prototype.processResponse;
dialect.prototype.processResponse = (obj: any, runner: any) => {
if (obj.method === 'raw' && obj.sql.trim().match('^insert into|update|delete')) {
return obj.context;
}
return processResponse(obj, runner);
};
dialect.prototype._query = (connection: any, obj: any) => {
const callMethod = this.getCallMethod(obj);
return new Bluebird((resolve: any, reject: any) => {
/* istanbul ignore if */
if (!connection || !connection[callMethod]) {
return reject(new Error(`Error calling ${callMethod} on connection.`));
}
private getPatchedDialect() {
const dialect = require('knex/lib/dialects/sqlite3/index.js');
const processResponse = dialect.prototype.processResponse;
dialect.prototype.processResponse = (obj: any, runner: any) => {
if (obj.method === 'raw' && obj.sql.trim().match('^insert into|update|delete')) {
return obj.context;
}
return processResponse(obj, runner);
};
dialect.prototype._query = (connection: any, obj: any) => {
const callMethod = this.getCallMethod(obj);
return new Bluebird((resolve: any, reject: any) => {
/* istanbul ignore if */
if (!connection || !connection[callMethod]) {
return reject(new Error(`Error calling ${callMethod} on connection.`));
}
connection[callMethod](obj.sql, obj.bindings, function (this: any, err: any, response: any) {
if (err) {
return reject(err);
}
obj.response = response;
obj.context = this;