Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow user of ConnectionPool to override default tedious version #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Once the Tedious Connection object has been acquired, the tedious API can be use

```javascript
var ConnectionPool = require('tedious-connection-pool');
ConnectionPool.overrideTedious(require('tedious'));
var Request = require('tedious').Request;

var poolConfig = {
Expand Down Expand Up @@ -76,6 +77,9 @@ pool.drain();

## Class: ConnectionPool

### ConnectionPool.overrideTedious(tedious)
Create connections using specified tedious module rather than ConnectionPool's default version of tedious.

### new ConnectionPool(poolConfig, connectionConfig)

* `poolConfig` {Object} the pool configuration object
Expand Down
7 changes: 6 additions & 1 deletion lib/connection-pool.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var Connection = require('tedious').Connection;
var Connection = require('tedious').Connection; // load default tedious version
var EventEmitter = require('events').EventEmitter;
var util = require('util');

Expand Down Expand Up @@ -52,6 +52,11 @@ function ConnectionPool(poolConfig, connectionConfig) {

util.inherits(ConnectionPool, EventEmitter);

ConnectionPool.overrideTedious = function(tedious) {
Connection = tedious.Connection; // allow user of ConnectionPool to override default tedious version
return ConnectionPool;
};

var cid = 1;

function createConnection(pooled) {
Expand Down