From 05d34d7b128eda2f7b96086542a35096d311c895 Mon Sep 17 00:00:00 2001 From: Ben Page Date: Thu, 9 Jun 2016 13:49:25 -0500 Subject: [PATCH] modifies the Tedious Connection rather than the Connection prototype --- lib/connection-pool.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/connection-pool.js b/lib/connection-pool.js index ba169da..f6fe152 100755 --- a/lib/connection-pool.js +++ b/lib/connection-pool.js @@ -3,9 +3,9 @@ var Connection = require('tedious').Connection; var EventEmitter = require('events').EventEmitter; var util = require('util'); -Connection.prototype.release = function() { +function release() { this.pool.release(this); -}; +} var PENDING = 0; var FREE = 1; @@ -63,6 +63,7 @@ function createConnection(pooled) { this.log('creating connection: ' + cid); var connection = new Connection(this.connectionConfig); + connection.release = release; connection.pool = this; if (pooled) { pooled.id = cid++; @@ -113,7 +114,7 @@ function createConnection(pooled) { connection.on('error', handleError); - var endHandler = function () { + endHandler = function () { self.log('connection ended: ' + pooled.id); if (self.drained) //pool has been drained return;