How to use the knex/lib/dialects/sqlite3/index.js.prototype function in knex

To help you get started, we’ve selected a few knex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikro-orm / mikro-orm / lib / connections / SqliteConnection.ts View on Github external
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.`));
        }
github mikro-orm / mikro-orm / lib / connections / SqliteConnection.ts View on Github external
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.`));
        }
github mikro-orm / mikro-orm / lib / connections / SqliteConnection.ts View on Github external
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;