Comparing version 7.0.0-alpha.1 to 7.0.0-alpha.2
v7.0.0 (2020-??-??) | ||
------------------- | ||
[change] Updated to latest Tedious 8.0.1 | ||
[change] Updated to latest Tedious 8 | ||
[change] Piped streams no longer have errors forwarded on to them ([1028](https://github.com/tediousjs/node-mssql/pull/1028)) | ||
[change] tedious config option `trustServerCertificate` defaults to `false` if not supplied ([1030](https://github.com/tediousjs/node-mssql/pull/1030)) | ||
@@ -5,0 +7,0 @@ v6.2.0 (2020-03-13) |
module.exports = require('./lib/tedious') |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -377,3 +377,2 @@ 'use strict' | ||
this.on('row', stream.write.bind(stream)) | ||
this.on('error', stream.emit.bind(stream, 'error')) | ||
this.on('done', () => { | ||
@@ -380,0 +379,0 @@ setImmediate(() => stream.end()) |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -99,3 +99,4 @@ 'use strict' | ||
length: column.size, | ||
type: DECLARATIONS[column.sqlType] | ||
type: DECLARATIONS[column.sqlType], | ||
nullable: column.nullable | ||
} | ||
@@ -238,8 +239,12 @@ | ||
const recordsets = [] | ||
const errors = [] | ||
const errorHandlers = {} | ||
const output = {} | ||
const rowsAffected = [] | ||
let hasReturned = false | ||
let row = null | ||
let columns = null | ||
let recordset = null | ||
const recordsets = [] | ||
const output = {} | ||
const rowsAffected = [] | ||
let handleOutput = false | ||
@@ -249,2 +254,37 @@ let isChunkedRecordset = false | ||
const handleError = (req, connection, info, moreErrors) => { | ||
const doReturn = !moreErrors | ||
if ((typeof info.sqlstate === 'string') && (info.sqlstate.toLowerCase() === '08s01')) { | ||
connection.hasError = true | ||
} | ||
const err = new RequestError(info, 'EREQUEST') | ||
err.code = 'EREQUEST' | ||
err.state = info.sqlstate | ||
if (this.stream) { | ||
this.emit('error', err) | ||
} else { | ||
if (doReturn && !hasReturned) { | ||
if (req) { | ||
for (const event in errorHandlers) { | ||
req.removeListener(event, errorHandlers[event]) | ||
} | ||
} | ||
if (connection) { | ||
this.parent.release(connection) | ||
delete this._cancel | ||
debug('request(%d): failed', IDS.get(this), err) | ||
} | ||
hasReturned = true | ||
callback(err) | ||
} | ||
} | ||
// we must collect errors even in stream mode | ||
errors.push(err) | ||
} | ||
// nested = function is called by this.execute | ||
@@ -293,3 +333,2 @@ | ||
if (err) return callback(err) | ||
let hasReturned = false | ||
@@ -457,23 +496,4 @@ debug('connection(%d): borrowed to request #%d', IDS.get(connection), IDS.get(this)) | ||
req.once('error', err => { | ||
if (hasReturned) { | ||
return | ||
} | ||
hasReturned = true | ||
req.on('error', errorHandlers.error = handleError.bind(null, req, connection)) | ||
if ((typeof err.sqlstate === 'string') && (err.sqlstate.toLowerCase() === '08s01')) { | ||
connection.hasError = true | ||
} | ||
err = new RequestError(err) | ||
err.code = 'EREQUEST' | ||
err.state = err.sqlstate | ||
delete this._cancel | ||
this.parent.release(connection) | ||
debug('request(%d): failed', IDS.get(this), err) | ||
callback(err) | ||
}) | ||
req.once('done', () => { | ||
@@ -480,0 +500,0 @@ if (hasReturned) { |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -33,13 +33,13 @@ 'use strict' | ||
options = options || {} | ||
column.name = name | ||
column.nullable = options.nullable | ||
column.primary = options.primary | ||
if (objectHasProperty(options, 'length')) { | ||
column.length = options.length | ||
} | ||
column.name = name; | ||
['nullable', 'primary', 'identity', 'readOnly', 'length'].forEach(prop => { | ||
if (objectHasProperty(options, prop)) { | ||
column[prop] = options[prop] | ||
} | ||
}) | ||
return this.push(column) | ||
} | ||
} | ||
) | ||
}) | ||
@@ -130,3 +130,5 @@ Object.defineProperty(this.rows, 'add', { | ||
}, { | ||
nullable: col.nullable | ||
nullable: col.nullable, | ||
identity: col.identity, | ||
readOnly: col.readOnly | ||
}) | ||
@@ -133,0 +135,0 @@ } |
@@ -24,3 +24,4 @@ 'use strict' | ||
options: Object.assign({ | ||
encrypt: typeof this.config.encrypt === 'boolean' ? this.config.encrypt : true | ||
encrypt: typeof this.config.encrypt === 'boolean' ? this.config.encrypt : true, | ||
trustServerCertificate: typeof this.config.trustServerCertificate === 'boolean' ? this.config.trustServerCertificate : false | ||
}, this.config.options), | ||
@@ -63,7 +64,3 @@ authentication: Object.assign({ | ||
const tedious = new tds.Connection(cfg) | ||
IDS.add(tedious, 'Connection') | ||
debug('pool(%d): connection #%d created', IDS.get(this), IDS.get(tedious)) | ||
debug('connection(%d): establishing', IDS.get(tedious)) | ||
tedious.once('connect', err => { | ||
tedious.connect(err => { | ||
if (err) { | ||
@@ -77,2 +74,5 @@ err = new ConnectionError(err) | ||
}) | ||
IDS.add(tedious, 'Connection') | ||
debug('pool(%d): connection #%d created', IDS.get(this), IDS.get(tedious)) | ||
debug('connection(%d): establishing', IDS.get(tedious)) | ||
@@ -79,0 +79,0 @@ tedious.on('end', () => { |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ const IDS = new WeakMap() |
@@ -0,0 +0,0 @@ MIT License |
module.exports = require('./lib/msnodesqlv8') |
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "7.0.0-alpha.1", | ||
"version": "7.0.0-alpha.2", | ||
"main": "index.js", | ||
@@ -32,3 +32,3 @@ "repository": "github:tediousjs/node-mssql", | ||
"tarn": "^1.1.5", | ||
"tedious": "^8.0.1" | ||
"tedious": "^8.3.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -106,2 +106,3 @@ # node-mssql | ||
* [Contributing](https://github.com/tediousjs/node-mssql/wiki/Contributing) | ||
* [6.x to 7.x changes (pre-release)](#6x-to-7x-changes-pre-release) | ||
* [5.x to 6.x changes](#5x-to-6x-changes) | ||
@@ -646,3 +647,3 @@ * [4.x to 5.x changes](#4x-to-5x-changes) | ||
```js | ||
require('mssql').connect(...config, beforeConnect: conn => { | ||
require('mssql').connect({...config, beforeConnect: conn => { | ||
conn.once('connect', err => { err ? console.error(err) : console.log('mssql connected')}) | ||
@@ -1780,2 +1781,8 @@ conn.once('end', err => { err ? console.error(err) : console.log('mssql disconnected')}) | ||
## 6.x to 7.x changes (pre-release) | ||
- Upgraded tedious version to v8 | ||
- Requests in stream mode that pipe into other streams no longer pass errors up the stream chain | ||
- tedious config option `trustServerCertificate` defaults to `false` if not supplied | ||
## 5.x to 6.x changes | ||
@@ -1782,0 +1789,0 @@ |
module.exports = require('./lib/tedious') |
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
37
4589
1838
230094
Updatedtedious@^8.3.0