Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,5 @@ | ||
v1.0.1 (2014-07-04) | ||
------------------- | ||
[new] Added support for Streaming in Prepared Statements | ||
v1.0.0 (2014-07-04) | ||
@@ -2,0 +6,0 @@ ------------------- |
@@ -379,3 +379,5 @@ // Generated by CoffeeScript 1.7.1 | ||
PreparedStatement.prototype.stream = null; | ||
/* | ||
@@ -500,2 +502,3 @@ Create new Prepared Statement. | ||
req = new Request(_this); | ||
req.stream = false; | ||
req.output('handle', TYPES.Int); | ||
@@ -597,2 +600,5 @@ req.input('params', TYPES.NVarChar, ((function() { | ||
req = new Request(this); | ||
if (this.stream != null) { | ||
req.stream = this.stream; | ||
} | ||
req.input('handle', TYPES.Int, this._handle); | ||
@@ -656,2 +662,3 @@ _ref1 = this.parameters; | ||
req = new Request(this); | ||
req.stream = false; | ||
req.input('handle', TYPES.Int, this._handle); | ||
@@ -658,0 +665,0 @@ req.execute('sp_unprepare', done); |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
@@ -23,0 +23,0 @@ "repository": { |
@@ -813,3 +813,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) | ||
console.log(recordset[0].value); // return 12345 | ||
}) | ||
}); | ||
}); | ||
@@ -831,6 +831,35 @@ ``` | ||
console.log(recordsets[0][0].value); // return 12345 | ||
}) | ||
}); | ||
}); | ||
``` | ||
You can also stream executed request. | ||
```javascript | ||
var ps = new sql.PreparedStatement(); | ||
ps.input('param', sql.Int); | ||
ps.prepare('select @param as value', function(err) { | ||
// ... error checks | ||
ps.stream = true; | ||
request = ps.execute({param: 12345}); | ||
request.on('recordset', function(columns) { | ||
// Emitted once for each recordset in a query | ||
}); | ||
request.on('row', function(row) { | ||
// Emitted for each row in a recordset | ||
}); | ||
request.on('error', function(err) { | ||
// May be emitted multiple times | ||
}); | ||
request.on('done', function(returnValue) { | ||
// Always emitted as the last one | ||
}); | ||
}); | ||
``` | ||
__Errors__ | ||
@@ -837,0 +866,0 @@ - ENOTPREPARED (`PreparedStatementError`) - Statement is not prepared. |
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
256047
3916
1170