mssql
Advanced tools
Comparing version 7.0.0-beta.3 to 7.0.0-beta.4
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)) |
@@ -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
253072
4965
2119
+ Added@azure/abort-controller@1.1.0(transitive)
+ Added@azure/core-client@1.9.2(transitive)
+ Added@azure/core-http-compat@2.1.2(transitive)
+ Added@azure/core-lro@2.7.2(transitive)
+ Added@azure/core-paging@1.6.2(transitive)
+ Added@azure/core-rest-pipeline@1.16.0(transitive)
+ Added@azure/core-tracing@1.0.0-preview.121.1.2(transitive)
+ Added@azure/identity@1.5.2(transitive)
+ Added@azure/keyvault-keys@4.8.0(transitive)
+ Added@azure/logger@1.1.2(transitive)
+ Added@azure/msal-common@4.5.1(transitive)
+ Added@azure/msal-node@1.0.0-beta.6(transitive)
+ Added@opentelemetry/api@1.8.0(transitive)
+ Added@types/node@20.13.0(transitive)
+ Added@types/stoppable@1.1.3(transitive)
+ Addedagent-base@7.1.1(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.05.1.0(transitive)
+ Addedbuffer@5.7.16.0.3(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedchownr@1.1.4(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddetect-libc@2.0.3(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedexpand-template@2.0.3(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgithub-from-package@0.0.0(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhttp-proxy-agent@7.0.2(transitive)
+ Addedhttps-proxy-agent@7.0.4(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-docker@2.2.1(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addedjsonwebtoken@8.5.1(transitive)
+ Addedjwa@2.0.0(transitive)
+ Addedjws@4.0.0(transitive)
+ Addedkeytar@7.9.0(transitive)
+ Addedlodash.includes@4.3.0(transitive)
+ Addedlodash.isboolean@3.0.3(transitive)
+ Addedlodash.isinteger@4.0.4(transitive)
+ Addedlodash.isnumber@3.0.3(transitive)
+ Addedlodash.isplainobject@4.0.6(transitive)
+ Addedlodash.isstring@4.0.1(transitive)
+ Addedlodash.once@4.1.1(transitive)
+ Addedmimic-response@3.1.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addedmsal@1.4.18(transitive)
+ Addednapi-build-utils@1.0.2(transitive)
+ Addednode-abi@3.63.0(transitive)
+ Addednode-abort-controller@2.0.0(transitive)
+ Addednode-addon-api@4.3.0(transitive)
+ Addedobject-inspect@1.13.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedopen@7.4.2(transitive)
+ Addedprebuild-install@7.1.2(transitive)
+ Addedpump@3.0.0(transitive)
+ Addedqs@6.12.1(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedsemver@5.7.27.6.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@4.0.1(transitive)
+ Addedstoppable@1.1.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedtedious@11.8.0(transitive)
+ Addedundici-types@5.26.5(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removed@types/node@8.10.66(transitive)
- Removedadal-node@0.1.28(transitive)
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.0(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbl@3.0.1(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtedious@9.2.3(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedverror@1.10.0(transitive)
- Removedxmldom@0.6.0(transitive)
Updatedtedious@^11.0.5