Comparing version 0.4.4 to 0.4.5
@@ -0,1 +1,9 @@ | ||
v0.4.5 (2014-01-23) | ||
------------------- | ||
[new] Added support for "co" flow controller via co-mssql module | ||
v0.4.4 (2014-01-22) | ||
------------------- | ||
[change] returnValue also accessible as property of recordsets | ||
v0.4.3 (2014-01-14) | ||
@@ -2,0 +10,0 @@ ------------------- |
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var Connection, Request, TYPES, Transaction, events, getTypeByValue, global_connection, key, map, util, value; | ||
var Connection, DRIVERS, Request, TYPES, Transaction, events, getTypeByValue, global_connection, key, map, util, value, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -11,2 +12,4 @@ events = require('events'); | ||
DRIVERS = ['msnodesql', 'tedious', 'tds']; | ||
global_connection = null; | ||
@@ -133,3 +136,3 @@ | ||
function Connection(config, callback) { | ||
var err, _base, _base1; | ||
var err, _base, _base1, _ref; | ||
this.config = config; | ||
@@ -142,8 +145,4 @@ if ((_base = this.config).driver == null) { | ||
} | ||
if (this.config.driver === 'tedious') { | ||
this.driver = require('./tedious')(Connection, Transaction, Request); | ||
} else if (this.config.driver === 'msnodesql') { | ||
this.driver = require('./msnodesql')(Connection, Transaction, Request); | ||
} else if (this.config.driver === 'tds') { | ||
this.driver = require('./tds')(Connection, Transaction, Request); | ||
if (_ref = this.config.driver, __indexOf.call(DRIVERS, _ref) >= 0) { | ||
this.driver = this.initializeDriver(require("./" + this.config.driver)); | ||
} else { | ||
@@ -163,2 +162,16 @@ err = new Error("Unknown driver " + this.config.driver + "!"); | ||
/* | ||
Initializes driver for this connection. Separated from constructor and used by co-mssql. | ||
@private | ||
@param {Function} driver Loaded driver. | ||
@returns {Connection} | ||
*/ | ||
Connection.prototype.initializeDriver = function(driver) { | ||
return driver(Connection, Transaction, Request); | ||
}; | ||
/* | ||
Create connection to the server. | ||
@@ -193,3 +206,3 @@ | ||
this.connecting = true; | ||
this.driver.connection.prototype.connect.call(this, this.config, function(err) { | ||
this.driver.Connection.prototype.connect.call(this, this.config, function(err) { | ||
if (!_this.connecting) { | ||
@@ -217,7 +230,7 @@ return; | ||
this.connecting = false; | ||
this.driver.connection.prototype.close.call(this); | ||
this.driver.Connection.prototype.close.call(this); | ||
this.driver = null; | ||
} else if (this.connected) { | ||
this.connected = false; | ||
this.driver.connection.prototype.close.call(this); | ||
this.driver.Connection.prototype.close.call(this); | ||
this.driver = null; | ||
@@ -294,3 +307,3 @@ } | ||
} | ||
this.connection.driver.transaction.prototype.begin.call(this, callback); | ||
this.connection.driver.Transaction.prototype.begin.call(this, callback); | ||
return this; | ||
@@ -313,3 +326,3 @@ }; | ||
} | ||
this.connection.driver.transaction.prototype.commit.call(this, callback); | ||
this.connection.driver.Transaction.prototype.commit.call(this, callback); | ||
return this; | ||
@@ -383,3 +396,3 @@ }; | ||
} | ||
this.connection.driver.transaction.prototype.rollback.call(this, callback); | ||
this.connection.driver.Transaction.prototype.rollback.call(this, callback); | ||
return this; | ||
@@ -417,3 +430,3 @@ }; | ||
@param {Connection} connection If ommited, global connection is used instead. | ||
@param {Connection|Transaction} connection If ommited, global connection is used instead. | ||
*/ | ||
@@ -440,3 +453,3 @@ | ||
Request.prototype._acquire = function(callback) { | ||
return this.connection.driver.request.prototype._acquire.call(this, callback); | ||
return this.connection.driver.Request.prototype._acquire.call(this, callback); | ||
}; | ||
@@ -450,3 +463,3 @@ | ||
Request.prototype._release = function(connection) { | ||
return this.connection.driver.request.prototype._release.call(this, connection); | ||
return this.connection.driver.Request.prototype._release.call(this, connection); | ||
}; | ||
@@ -563,3 +576,3 @@ | ||
} | ||
this.connection.driver.request.prototype.query.call(this, command, callback); | ||
this.connection.driver.Request.prototype.query.call(this, command, callback); | ||
return this; | ||
@@ -603,3 +616,3 @@ }; | ||
} | ||
this.connection.driver.request.prototype.execute.call(this, procedure, callback); | ||
this.connection.driver.Request.prototype.execute.call(this, procedure, callback); | ||
return this; | ||
@@ -616,3 +629,3 @@ }; | ||
Request.prototype.cancel = function() { | ||
this.connection.driver.request.prototype.cancel.call(this); | ||
this.connection.driver.Request.prototype.cancel.call(this); | ||
return this; | ||
@@ -658,2 +671,4 @@ }; | ||
module.exports.DRIVERS = DRIVERS; | ||
module.exports.TYPES = TYPES; | ||
@@ -660,0 +675,0 @@ |
@@ -496,3 +496,3 @@ // Generated by CoffeeScript 1.6.3 | ||
this.nested = true; | ||
return this.query(cmd, function(err, recordsets) { | ||
return MsnodesqlRequest.prototype.query.call(this, cmd, function(err, recordsets) { | ||
var elapsed, last, returnValue, _ref4, _ref5; | ||
@@ -548,5 +548,5 @@ _this.nested = false; | ||
return { | ||
connection: MsnodesqlConnection, | ||
transaction: MsnodesqlTransaction, | ||
request: MsnodesqlRequest | ||
Connection: MsnodesqlConnection, | ||
Transaction: MsnodesqlTransaction, | ||
Request: MsnodesqlRequest | ||
}; | ||
@@ -553,0 +553,0 @@ }; |
@@ -474,3 +474,3 @@ // Generated by CoffeeScript 1.6.3 | ||
this.nested = true; | ||
return this.query(cmd, function(err, recordsets) { | ||
return TDSRequest.prototype.query.call(this, cmd, function(err, recordsets) { | ||
var elapsed, last, returnValue, _ref4, _ref5; | ||
@@ -526,5 +526,5 @@ _this.nested = false; | ||
return { | ||
connection: TDSConnection, | ||
transaction: TDSTransaction, | ||
request: TDSRequest | ||
Connection: TDSConnection, | ||
Transaction: TDSTransaction, | ||
Request: TDSRequest | ||
}; | ||
@@ -531,0 +531,0 @@ }; |
@@ -606,5 +606,5 @@ // Generated by CoffeeScript 1.6.3 | ||
return { | ||
connection: TediousConnection, | ||
transaction: TediousTransaction, | ||
request: TediousRequest | ||
Connection: TediousConnection, | ||
Transaction: TediousTransaction, | ||
Request: TediousRequest | ||
}; | ||
@@ -611,0 +611,0 @@ }; |
{ | ||
"author": { | ||
"name": "Patrik Simek", | ||
"url": "http://patriksimek.cz" | ||
"url": "https://patriksimek.cz" | ||
}, | ||
"name": "mssql", | ||
"description": "An easy-to-use MSSQL database connector for NodeJS.", | ||
"description": "An easy-to-use MSSQL database connector for Node.js.", | ||
"keywords": [ | ||
@@ -19,3 +19,3 @@ "database", | ||
], | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"main": "index.js", | ||
@@ -44,4 +44,5 @@ "repository": { | ||
"scripts": { | ||
"test": "mocha --compilers coffee:coffee-script --reporter spec" | ||
"test": "mocha", | ||
"prepublish": "coffee --compile --output ./lib ./src" | ||
} | ||
} |
# node-mssql [![Dependency Status](https://david-dm.org/patriksimek/node-mssql.png)](https://david-dm.org/patriksimek/node-mssql) [![NPM version](https://badge.fury.io/js/mssql.png)](http://badge.fury.io/js/mssql) | ||
An easy-to-use MSSQL database connector for NodeJS. | ||
An easy-to-use MSSQL database connector for Node.js. | ||
@@ -17,9 +17,5 @@ There are some TDS modules which offer functionality to communicate with MSSQL databases but none of them does offer enough comfort - implementation takes a lot of lines of code. So I decided to create this module, that make work as easy as it could without loosing any important functionality. | ||
## What's new in 0.4 | ||
## What's new in 0.4.5 | ||
* Added support for transactions. | ||
* [node-tds](https://github.com/cretz/node-tds) is now available as an optional TDS driver. | ||
* Documentation updated to [CSDoc](https://github.com/patriksimek/csdoc) spec. | ||
* Tedious driver no longer use [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) for connection pooling | ||
* [Microsoft Driver for Node.js for SQL Server](https://github.com/WindowsAzure/node-sqlserver) is now pooled | ||
* Added support for [co](https://github.com/visionmedia/co) flow controller via [co-mssql](https://github.com/patriksimek/co-mssql) module | ||
@@ -26,0 +22,0 @@ ## Installation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142310
2289
597
1