How to use the machinepack-mysql.releaseConnection function in machinepack-mysql

To help you get started, we’ve selected a few machinepack-mysql 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 balderdashy / sails-mysql / helpers / private / connection / release-connection.js View on Github external
module.exports = function releaseConnection(connection, leased, cb) {
  // If this connection was leased outside of the Adapter, don't release it.
  if (leased) {
    return setImmediate(function ensureAsync() {
      return cb();
    });
  }

  MySQL.releaseConnection({
    connection: connection
  }).switch({
    error: function error(err) {
      return cb(new Error('There was an error releasing the connection back into the pool.' + err.stack));
    },
    badConnection: function badConnection() {
      return cb(new Error('Bad connection when trying to release an active connection.'));
    },
    success: function success() {
      return cb();
    }
  });
};
github balderdashy / sails-mysql / test / support / bootstrap.js View on Github external
}).exec(function dropTableCb(err) {
      if (err) {
        return cb(err);
      }

      MySQL.releaseConnection({
        connection: report.connection
      }).exec(function releaseConnectionCb(err) {
        if (err) {
          return cb(err);
        }

        delete adapter.datastores[_.first(_.keys(adapter.datastores))];
        return cb();
      });
    });
  });
github balderdashy / sails-mysql / test / support / bootstrap.js View on Github external
}).exec(function seedCb(err) {
      if (err) {
        return cb(err);
      }

      MySQL.releaseConnection({
        connection: report.connection
      }).exec(cb);
    });
  });