Skip to content

Commit

Permalink
Move source files about in to a better structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekim committed Oct 7, 2012
1 parent 0864ac7 commit 02f3c2b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
19 changes: 1 addition & 18 deletions index.js → lib/connection-pool.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var Connection = require('tedious').Connection;
var util = require('util');
var PooledConnection = require('./pooled-connection');

var connectionEventNames = [
'connect',
Expand All @@ -13,22 +12,6 @@ var connectionEventNames = [
'secure'
];

function PooledConnection(pool, config) {
Connection.call(this, config);
this.pool = pool;
}

util.inherits(PooledConnection, Connection);

PooledConnection.prototype.close = function() {
this.emit('end');
this.pool.returnConnectionToPool(this);
}

PooledConnection.prototype._close = function() {
Connection.prototype.close.call(this);
}

function ConnectionPool(poolConfig, connectionConfig) {
var pool = this;

Expand Down
20 changes: 20 additions & 0 deletions lib/pooled-connection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var Connection = require('tedious').Connection;
var util = require('util');

function PooledConnection(pool, config) {
Connection.call(this, config);
this.pool = pool;
}

util.inherits(PooledConnection, Connection);

PooledConnection.prototype.close = function() {
this.emit('end');
this.pool.returnConnectionToPool(this);
}

PooledConnection.prototype._close = function() {
Connection.prototype.close.call(this);
}

module.exports = PooledConnection;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tedious-connection-pool",
"version": "0.0.1",
"description": "Connection Pool for tedious.",
"main": "index.js",
"main": "lib/connection-pool.js",
"scripts": {
"test": "test"
},
Expand Down
2 changes: 1 addition & 1 deletion test/connection-pool.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assert')
var async = require('async')
var ConnectionPool = require('../index');
var ConnectionPool = require('../lib/connection-pool');
var Request = require('tedious').Request;

var connectionConfig = {
Expand Down

0 comments on commit 02f3c2b

Please sign in to comment.