mssql 9.1.1 → 9.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,22 +1,22 @@
1
- MIT License
2
-
3
- Copyright (c) 2013-2018 Patrik Simek and contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
1
+ MIT License
2
+
3
+ Copyright (c) 2013-2018 Patrik Simek and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Microsoft SQL Server client for Node.js
4
4
 
5
- [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Travis CI][travis-image]][travis-url] [![Appveyor CI][appveyor-image]][appveyor-url] [![Join the chat at https://gitter.im/patriksimek/node-mssql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/patriksimek/node-mssql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+ [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Appveyor CI][appveyor-image]][appveyor-url] [![Join the chat at https://gitter.im/patriksimek/node-mssql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/patriksimek/node-mssql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
6
 
7
7
  Supported TDS drivers:
8
8
  - [Tedious][tedious-url] (pure JavaScript - Windows/macOS/Linux, default)
@@ -140,6 +140,8 @@ async () => {
140
140
  * [SQL injection](#sql-injection)
141
141
  * [Known Issues](#known-issues)
142
142
  * [Contributing](https://github.com/tediousjs/node-mssql/wiki/Contributing)
143
+ * [8.x to 9.x changes](#8x-to-9x-changes)
144
+ * [7.x to 8.x changes](#7x-to-8x-changes)
143
145
  * [6.x to 7.x changes](#6x-to-7x-changes)
144
146
  * [5.x to 6.x changes](#5x-to-6x-changes)
145
147
  * [4.x to 5.x changes](#4x-to-5x-changes)
@@ -2025,10 +2027,10 @@ request.query('select @myval as myval', (err, result) => {
2025
2027
  - If you're facing problems with connecting SQL Server 2000, try setting the default TDS version to 7.1 with `config.options.tdsVersion = '7_1'` ([issue](https://github.com/tediousjs/node-mssql/issues/36))
2026
2028
  - If you're executing a statement longer than 4000 chars on SQL Server 2000, always use [batch](#batch-batch-callback) instead of [query](#query-command-callback) ([issue](https://github.com/tediousjs/node-mssql/issues/68))
2027
2029
 
2028
- ## 8.x to 7.x changes
2030
+ ## 8.x to 9.x changes
2029
2031
 
2030
2032
  - Upgraded to tedious version 15
2031
- - Dropped support for Node version < 12
2033
+ - Dropped support for Node version <= 12
2032
2034
 
2033
2035
  ## 7.x to 8.x changes
2034
2036
 
@@ -2091,8 +2093,6 @@ to create new connections or not
2091
2093
  [downloads-url]: https://www.npmjs.com/package/mssql
2092
2094
  [david-image]: https://img.shields.io/david/tediousjs/node-mssql.svg?style=flat-square
2093
2095
  [david-url]: https://david-dm.org/tediousjs/node-mssql
2094
- [travis-image]: https://img.shields.io/travis/tediousjs/node-mssql/master.svg?style=flat-square&label=unit
2095
- [travis-url]: https://travis-ci.org/tediousjs/node-mssql
2096
2096
  [appveyor-image]: https://ci.appveyor.com/api/projects/status/e5gq1a0ujwams9t7/branch/master?svg=true
2097
2097
  [appveyor-url]: https://ci.appveyor.com/project/tediousjs/node-mssql
2098
2098
 
package/bin/mssql CHANGED
File without changes
@@ -64,9 +64,10 @@ class ConnectionPool extends EventEmitter {
64
64
  this.config.arrayRowMode = this.config.arrayRowMode || false
65
65
  this.config.validateConnection = 'validateConnection' in this.config ? this.config.validateConnection : true
66
66
 
67
- if (/^(.*)\\(.*)$/.exec(this.config.server)) {
68
- this.config.server = RegExp.$1
69
- this.config.options.instanceName = RegExp.$2
67
+ const namedServer = /^(.*)\\(.*)$/.exec(this.config.server)
68
+ if (namedServer) {
69
+ this.config.server = namedServer[1]
70
+ this.config.options.instanceName = namedServer[2]
70
71
  }
71
72
 
72
73
  if (typeof this.config.options.useColumnNames !== 'undefined' && this.config.options.useColumnNames !== true) {
@@ -149,13 +150,21 @@ class ConnectionPool extends EventEmitter {
149
150
  if (/^tcp:/i.test(server)) {
150
151
  server = server.substr(4)
151
152
  }
152
- if (/^(.*)\\(.*)$/.exec(server)) {
153
- server = RegExp.$1
154
- instanceName = RegExp.$2
153
+ const namedServerParts = /^(.*)\\(.*)$/.exec(server)
154
+ if (namedServerParts) {
155
+ server = namedServerParts[1].trim()
156
+ instanceName = namedServerParts[2].trim()
155
157
  }
156
- if (/^(.*),(.*)$/.exec(server)) {
157
- server = RegExp.$1.trim()
158
- port = parseInt(RegExp.$2.trim(), 10)
158
+ const serverParts = /^(.*),(.*)$/.exec(server)
159
+ if (serverParts) {
160
+ server = serverParts[1].trim()
161
+ port = parseInt(serverParts[2].trim(), 10)
162
+ } else {
163
+ const instanceParts = /^(.*),(.*)$/.exec(instanceName)
164
+ if (instanceParts) {
165
+ instanceName = instanceParts[1].trim()
166
+ port = parseInt(instanceParts[2].trim(), 10)
167
+ }
159
168
  }
160
169
  if (server === '.' || server === '(.)' || server.toLowerCase() === '(localdb)' || server.toLowerCase() === '(local)') {
161
170
  server = 'localhost'
@@ -239,9 +248,10 @@ class ConnectionPool extends EventEmitter {
239
248
  case 'user id': {
240
249
  let user = value
241
250
  let domain
242
- if (/^(.*)\\(.*)$/.exec(user)) {
243
- domain = RegExp.$1
244
- user = RegExp.$2
251
+ const domainUser = /^(.*)\\(.*)$/.exec(user)
252
+ if (domainUser) {
253
+ domain = domainUser[1]
254
+ user = domainUser[2]
245
255
  }
246
256
  Object.assign(config, {
247
257
  domain,
@@ -43,8 +43,9 @@ class RequestError extends MSSQLError {
43
43
  }
44
44
 
45
45
  this.name = 'RequestError'
46
- if ((/^\[Microsoft\]\[SQL Server Native Client 11\.0\](?:\[SQL Server\])?([\s\S]*)$/).exec(this.message)) {
47
- this.message = RegExp.$1
46
+ const parsedMessage = (/^\[Microsoft\]\[SQL Server Native Client 11\.0\](?:\[SQL Server\])?([\s\S]*)$/).exec(this.message)
47
+ if (parsedMessage) {
48
+ this.message = parsedMessage[1]
48
49
  }
49
50
  }
50
51
  }
@@ -1,9 +1,9 @@
1
- 'use strict'
2
-
3
- module.exports = {
4
- READ_UNCOMMITTED: 0x01,
5
- READ_COMMITTED: 0x02,
6
- REPEATABLE_READ: 0x03,
7
- SERIALIZABLE: 0x04,
8
- SNAPSHOT: 0x05
9
- }
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ READ_UNCOMMITTED: 0x01,
5
+ READ_COMMITTED: 0x02,
6
+ REPEATABLE_READ: 0x03,
7
+ SERIALIZABLE: 0x04,
8
+ SNAPSHOT: 0x05
9
+ }
@@ -38,8 +38,15 @@ class ConnectionPool extends BaseConnectionPool {
38
38
  return this.config.options.trustedConnection ? 'Yes' : 'No'
39
39
  case 'encrypt':
40
40
  return this.config.options.encrypt ? 'Yes' : 'No'
41
- default:
42
- return this.config[key] != null ? this.config[key] : ''
41
+ default: {
42
+ let val = this.config[key] || ''
43
+ // quote strings that contain '{' or '}' but not ones that start and end with them (assume they are already quoted)
44
+ if (val && typeof val === 'string' && !(val.startsWith('{') && val.endsWith('}')) && (val.indexOf('{') !== -1 || val.indexOf('}') !== -1)) {
45
+ // quote values in `{}` and escape any existing `}` chars
46
+ val = `{${val.replace(/}/g, '}}')}}`
47
+ }
48
+ return val
49
+ }
43
50
  }
44
51
  })
45
52
 
@@ -531,8 +531,9 @@ class Request extends BaseRequest {
531
531
  })
532
532
 
533
533
  req.on('info', msg => {
534
- if ((/^\[Microsoft\]\[SQL Server Native Client 11\.0\](?:\[SQL Server\])?([\s\S]*)$/).exec(msg.message)) {
535
- msg.message = RegExp.$1
534
+ const parsedMessage = (/^\[Microsoft\]\[SQL Server Native Client 11\.0\](?:\[SQL Server\])?([\s\S]*)$/).exec(msg.message)
535
+ if (parsedMessage) {
536
+ msg.message = parsedMessage[1]
536
537
  }
537
538
 
538
539
  this.emit('info', {
package/package.json CHANGED
@@ -21,20 +21,27 @@
21
21
  "azure",
22
22
  "node-mssql"
23
23
  ],
24
- "version": "9.1.1",
24
+ "version": "9.1.3",
25
25
  "main": "index.js",
26
26
  "repository": "github:tediousjs/node-mssql",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@tediousjs/connection-string": "^0.4.1",
30
- "commander": "^9.4.0",
30
+ "commander": "^11.0.0",
31
31
  "debug": "^4.3.3",
32
32
  "rfdc": "^1.3.0",
33
33
  "tarn": "^3.0.2",
34
34
  "tedious": "^15.0.1"
35
35
  },
36
36
  "devDependencies": {
37
+ "@commitlint/cli": "^17.6.6",
38
+ "@commitlint/config-conventional": "^17.6.6",
39
+ "@semantic-release/commit-analyzer": "^10.0.1",
40
+ "@semantic-release/github": "^9.0.3",
41
+ "@semantic-release/npm": "^10.0.4",
42
+ "@semantic-release/release-notes-generator": "^11.0.4",
37
43
  "mocha": "^10.0.0",
44
+ "semantic-release": "^21.0.7",
38
45
  "standard": "^17.0.0"
39
46
  },
40
47
  "engines": {
@@ -47,11 +54,12 @@
47
54
  "msnodesqlv8.js"
48
55
  ],
49
56
  "scripts": {
57
+ "commitlint": "commitlint --from origin/master --to HEAD",
50
58
  "test": "npm run lint && npm run test-unit",
51
59
  "lint": "standard",
52
60
  "test-unit": "mocha --exit -t 15000 test/common/unit.js",
53
61
  "test-tedious": "mocha --exit -t 15000 test/tedious",
54
- "test-msnodesqlv8": "mocha --exit -t 15000 test/msnodesqlv8",
62
+ "test-msnodesqlv8": "mocha --exit -t 30000 test/msnodesqlv8",
55
63
  "test-cli": "mocha --exit -t 15000 test/common/cli.js"
56
64
  },
57
65
  "bin": {