Socket
Socket
Sign inDemoInstall

mssql

Package Overview
Dependencies
136
Maintainers
4
Versions
166
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.3 to 7.0.0-beta.4

5

CHANGELOG.txt
v7.0.0 (2021-??-??)
-------------------
[new] Result sets with duplicate keys can now be handled using `request.arrayRowMode` ([#1130](https://github.com/tediousjs/node-mssql/pull/1130))
[change] Updated to latest Tedious 9
[new] Requests in stream mode now emit a `rowsaffected` event ([#1213](https://github.com/tediousjs/node-mssql/pull/1213))
[new] msnodesqlv8 driver now has detailed error support ([#1212](https://github.com/tediousjs/node-mssql/pull/1212))
[new] Connection validation checks before releasing connections from the pool. This can be turned of via `validateConnection: false` config option ([#1192](https://github.com/tediousjs/node-mssql/pull/1192))
[change] Updated to latest Tedious 11
[change] Updated tarnjs to v3

@@ -6,0 +9,0 @@ [change] Updated to support latest msnodesqlv8 v2 ([#1157](https://github.com/tediousjs/node-mssql/pull/1157))

1

lib/base/connection-pool.js

@@ -63,2 +63,3 @@ 'use strict'

this.config.arrayRowMode = this.config.arrayRowMode || false
this.config.validateConnection = 'validateConnection' in this.config ? this.config.validateConnection : true

@@ -65,0 +66,0 @@ if (/^(.*)\\(.*)$/.exec(this.config.server)) {

@@ -35,4 +35,9 @@ 'use strict'

} else {
this.number = message.code // err.code is returned by msnodesql driver
this.state = message.sqlstate // err.sqlstate is returned by msnodesql driver
// Use err attributes returned by msnodesql driver
this.number = message.code
this.lineNumber = message.lineNumber
this.state = message.sqlstate
this.class = message.severity
this.serverName = message.serverName
this.procName = message.procName
}

@@ -39,0 +44,0 @@ }

@@ -31,3 +31,3 @@ 'use strict'

cfg.conn_str = cfg.conn_str.replace(new RegExp('#{([^}]*)}', 'g'), (p) => {
cfg.conn_str = cfg.conn_str.replace(/#{([^}]*)}/g, (p) => {
const key = p.substr(2, p.length - 3)

@@ -69,3 +69,10 @@

_poolValidate (tds) {
return tds && !tds.hasError
if (tds && !tds.hasError) {
return !this.config.validateConnection || new shared.Promise((resolve) => {
tds.query('SELECT 1;', (err) => {
resolve(!err)
})
})
}
return false
}

@@ -72,0 +79,0 @@

@@ -268,3 +268,2 @@ 'use strict'

err.code = 'EREQUEST'
err.state = info.sqlstate

@@ -518,4 +517,7 @@ if (this.stream) {

req.on('rowcount', count => {
rowsAffected.push(count)
req.on('rowcount', rowCount => {
rowsAffected.push(rowCount)
if (this.stream) {
this.emit('rowsaffected', rowCount)
}
})

@@ -522,0 +524,0 @@

@@ -51,3 +51,3 @@ 'use strict'

case 'string':
for (var item of Array.from(map)) {
for (const item of Array.from(map)) {
if (item.js === String) {

@@ -61,4 +61,9 @@ return item.sql

case 'number':
case 'bigint':
if (value % 1 === 0) {
return TYPES.Int
if (value < -2147483648 || value > 2147483647) {
return TYPES.BigInt
} else {
return TYPES.Int
}
} else {

@@ -69,3 +74,3 @@ return TYPES.Float

case 'boolean':
for (item of Array.from(map)) {
for (const item of Array.from(map)) {
if (item.js === Boolean) {

@@ -79,3 +84,3 @@ return item.sql

case 'object':
for (item of Array.from(map)) {
for (const item of Array.from(map)) {
if (value instanceof item.js) {

@@ -82,0 +87,0 @@ return item.sql

@@ -99,3 +99,11 @@ 'use strict'

_poolValidate (tedious) {
return tedious && !tedious.closed && !tedious.hasError
if (tedious && !tedious.closed && !tedious.hasError) {
return !this.config.validateConnection || new shared.Promise((resolve) => {
const req = new tds.Request('SELECT 1;', (err) => {
resolve(!err)
})
tedious.execSql(req)
})
}
return false
}

@@ -102,0 +110,0 @@

@@ -509,3 +509,8 @@ 'use strict'

const doneHandler = (rowCount, more) => {
if (rowCount != null) rowsAffected.push(rowCount)
if (rowCount != null) {
rowsAffected.push(rowCount)
if (this.stream) {
this.emit('rowsaffected', rowCount)
}
}
// this function is called even when select only set variables so we should skip adding a new recordset

@@ -883,3 +888,8 @@ if (Object.keys(columns).length === 0) return

req.on('doneInProc', (rowCount, more) => {
if (rowCount != null) rowsAffected.push(rowCount)
if (rowCount != null) {
rowsAffected.push(rowCount)
if (this.stream) {
this.emit('rowsaffected', rowCount)
}
}

@@ -886,0 +896,0 @@ // filter empty recordsets when NOCOUNT is OFF

@@ -24,3 +24,3 @@ {

],
"version": "7.0.0-beta.3",
"version": "7.0.0-beta.4",
"main": "index.js",

@@ -33,7 +33,7 @@ "repository": "github:tediousjs/node-mssql",

"tarn": "^3.0.1",
"tedious": "^9.2.3"
"tedious": "^11.0.5"
},
"devDependencies": {
"mocha": "^8.1.3",
"standard": "^14.3.4"
"mocha": "^8.3.2",
"standard": "^16.0.3"
},

@@ -40,0 +40,0 @@ "engines": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc