Comparing version 0.5.2 to 0.5.3
@@ -0,1 +1,11 @@ | ||
v0.5.3 (2014-04-04) | ||
------------------- | ||
[fix] Multiple recordsets in Prepared Statements | ||
v0.5.2 (2014-04-04) | ||
------------------- | ||
[new] Support for Prepared Statements | ||
[fix] Fixed order of output parameters | ||
[fix] Minor fixes in node-tds driver | ||
v0.5.1 (2014-04-01) | ||
@@ -2,0 +12,0 @@ ------------------- |
@@ -310,2 +310,3 @@ // Generated by CoffeeScript 1.7.1 | ||
@property {Connection} connection Reference to used connection. | ||
@property {Boolean} multiple If `true`, `execute` will handle multiple recordsets. | ||
@property {String} statement Prepared SQL statement. | ||
@@ -335,3 +336,5 @@ */ | ||
PreparedStatement.prototype.multiple = false; | ||
/* | ||
@@ -566,3 +569,10 @@ Create new Prepared Statement. | ||
} | ||
req.execute('sp_execute', callback); | ||
req.execute('sp_execute', (function(_this) { | ||
return function(err, recordsets, returnValue) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, (_this.multiple ? recordsets : recordsets[0])); | ||
}; | ||
})(this)); | ||
return req; | ||
@@ -569,0 +579,0 @@ }; |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"main": "index.js", | ||
@@ -23,0 +23,0 @@ "repository": { |
@@ -21,3 +21,3 @@ # 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) | ||
## What's new in 0.5.2 (stable, npm) | ||
## What's new in 0.5.3 (stable, npm) | ||
@@ -609,3 +609,3 @@ - Support for [Prepared Statements](#prepared-statement) | ||
<a name="prepared-statement-input" /> | ||
### input(name, [type], value) | ||
### input(name, type) | ||
@@ -629,3 +629,3 @@ Add an input parameter to the prepared statement. | ||
<a name="prepared-statement-output" /> | ||
### output(name, type, [value]) | ||
### output(name, type) | ||
@@ -689,2 +689,4 @@ Add an output parameter to the prepared statement. | ||
// ... error checks | ||
console.log(recordset[0].value); // return 12345 | ||
}) | ||
@@ -694,2 +696,16 @@ }); | ||
You can enable multiple recordsets by `ps.multiple = true` command. | ||
var ps = new sql.PreparedStatement(); | ||
ps.input('param', sql.Int); | ||
ps.prepare('select @param as value', function(err) { | ||
// ... error checks | ||
ps.execute({param: 12345}, function(err, recordsets) { | ||
// ... error checks | ||
console.log(recordsets[0][0].value); // return 12345 | ||
}) | ||
}); | ||
--------------------------------------- | ||
@@ -714,9 +730,5 @@ | ||
ps.execute({param: 12345}, function(err, recordset) { | ||
ps.unprepare(function(err) { | ||
// ... error checks | ||
ps.unprepare(function(err) { | ||
// ... error checks | ||
}); | ||
}); | ||
@@ -809,3 +821,3 @@ }); | ||
Those errors are initialized in node-mssql module and it's stack can be cropped. You can always access original error with `err.originalError`. | ||
Those errors are initialized in node-mssql module and it's original stack can be cropped. You can always access original error with `err.originalError`. | ||
@@ -812,0 +824,0 @@ <a name="meta" /> |
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
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
229860
3588
966