Permalink
Browse files

Minot errors.

  • Loading branch information...
1 parent cd8d2b8 commit 6886d2cea52227061eed4002a681342aa8b4944f @Kijewski committed Mar 26, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/mysql-pool/pool.js
@@ -111,12 +111,15 @@ MySQLPool.prototype._forEach = function _forEach(params) {
// TODO: callback _once_
var pool = this;
var args = Array.prototype.slice.call(params.args);
+ while(typeof args[args.length-1] == "undefined") {
+ args.pop();
+ }
var cb = args.pop();
function mkCallback(client) {
return function(err) {
- if(params.cb) {
- cb.apply(client, arguments);
+ if(cb) {
+ cb.apply(client, Array.prototype.slice.call(arguments));
} else if(err) {
pool.emit("error", err);
}
@@ -125,7 +128,7 @@ MySQLPool.prototype._forEach = function _forEach(params) {
for(var i in this._connectionPool) {
var client = this._connectionPool[i];
- params.method.apply(client, params.args.concat(mkCallback(client)));
+ params.method.apply(client, args.concat(mkCallback(client)));
}
if(params.destroying) {

0 comments on commit 6886d2c

Please sign in to comment.