mssql 8.1.0 → 8.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/CHANGELOG.txt CHANGED
@@ -1,3 +1,16 @@
1
+ v8.1.3 (2022-08-08)
2
+ -------------------
3
+ [fix] requestTimeout correctly resolved ([#1398](https://github.com/tediousjs/node-mssql/pull/1398))
4
+ [fix] Forcibly deny use of `useColumnNames` tedious config option that can be passed in the config object ([#1416](https://github.com/tediousjs/node-mssql/pull/1416))
5
+
6
+ v8.1.2 (2022-05-27)
7
+ -------------------
8
+ [fix] quote identifiers in table constraint declaration ([#1397](https://github.com/tediousjs/node-mssql/pull/1397))
9
+
10
+ v8.1.1 (2022-05-18)
11
+ -------------------
12
+ [fix] quote identifiers in table primary keys ([#1394](https://github.com/tediousjs/node-mssql/pull/1394))
13
+
1
14
  v8.1.0 (2022-04-06)
2
15
  -------------------
3
16
  [new] MSSQL CLI tool now accepts some options to allow overriding config file ((#1381](https://github.com/tediousjs/node-mssql/pull/1381))
@@ -26,6 +39,23 @@ v8.0.0 (2022-01-30)
26
39
  [removed] Remove connection string parser helpers ((#1342)[https://github.com/tediousjs/node-mssql/pull/1342])
27
40
  [removed] Remove deprecated pool properties ((#1359)[https://github.com/tediousjs/node-mssql/pull/1359])
28
41
 
42
+ v7.3.5 (2022-05-27)
43
+ -------------------
44
+ [fix] quote identifiers in table constraint declaration ([#1397](https://github.com/tediousjs/node-mssql/pull/1397))
45
+
46
+ v7.3.4 (2022-05-18)
47
+ -------------------
48
+ [fix] msnodesqlv8.js file was missing from previous release
49
+
50
+ v7.3.3 (2022-05-18)
51
+ -------------------
52
+ Duplicate tag
53
+
54
+ v7.3.2 (2022-05-18)
55
+ -------------------
56
+ [fix] nodemsqlv8 driver tests working against Node 10 ([#1368](https://github.com/tediousjs/node-mssql/pull/1368))
57
+ [fix] quote identifiers in table primary keys ([#1394](https://github.com/tediousjs/node-mssql/pull/1394))
58
+
29
59
  v7.3.1 (2022-02-24)
30
60
  -------------------
31
61
  [fix] Bump debug dependency ([#1361](https://github.com/tediousjs/node-mssql/pull/1361))
package/README.md CHANGED
@@ -562,7 +562,7 @@ const config = {
562
562
  - **pool.max** - The maximum number of connections there can be in the pool (default: `10`).
563
563
  - **pool.min** - The minimum of connections there can be in the pool (default: `0`).
564
564
  - **pool.idleTimeoutMillis** - The Number of milliseconds before closing an unused connection (default: `30000`).
565
- - **arrayRowMode** - Return row results as a an array instead of a keyed object. Also adds `columns` array. See [Handling Duplicate Column Names](#handling-duplicate-column-names)
565
+ - **arrayRowMode** - Return row results as a an array instead of a keyed object. Also adds `columns` array. (default: `false`) See [Handling Duplicate Column Names](#handling-duplicate-column-names)
566
566
 
567
567
  Complete list of pool options can be found [here](https://github.com/vincit/tarn.js/#usage).
568
568
 
@@ -8,6 +8,7 @@ const { IDS } = require('../utils')
8
8
  const ConnectionError = require('../error/connection-error')
9
9
  const shared = require('../shared')
10
10
  const clone = require('rfdc/default')
11
+ const { MSSQLError } = require('../error')
11
12
 
12
13
  /**
13
14
  * Class ConnectionPool.
@@ -68,6 +69,14 @@ class ConnectionPool extends EventEmitter {
68
69
  this.config.options.instanceName = RegExp.$2
69
70
  }
70
71
 
72
+ if (typeof this.config.options.useColumnNames !== 'undefined' && this.config.options.useColumnNames !== true) {
73
+ const ex = new MSSQLError('Invalid options `useColumnNames`, use `arrayRowMode` instead')
74
+ if (typeof callback === 'function') {
75
+ return setImmediate(callback, ex)
76
+ }
77
+ throw ex
78
+ }
79
+
71
80
  if (typeof callback === 'function') {
72
81
  this.connect(callback)
73
82
  }
@@ -48,7 +48,7 @@ class Request extends EventEmitter {
48
48
  }
49
49
 
50
50
  /**
51
- * Generate sql string and set imput parameters from tagged template string.
51
+ * Generate sql string and set input parameters from tagged template string.
52
52
  *
53
53
  * @param {Template literal} template
54
54
  * @return {String}
@@ -21,13 +21,11 @@ class ConnectionPool extends BaseConnectionPool {
21
21
  defaultConnectionString = CONNECTION_STRING_NAMED_INSTANCE
22
22
  }
23
23
 
24
- if (this.config.requestTimeout == null) {
25
- this.config.requestTimeout = 15000
26
- }
24
+ this.config.requestTimeout = this.config.requestTimeout || this.config.timeout || 15000
27
25
 
28
26
  const cfg = {
29
27
  conn_str: this.config.connectionString || defaultConnectionString,
30
- conn_timeout: (this.config.connectionTimeout || 15000) / 1000
28
+ conn_timeout: (this.config.connectionTimeout || this.config.timeout || 15000) / 1000
31
29
  }
32
30
 
33
31
  cfg.conn_str = cfg.conn_str.replace(/#{([^}]*)}/g, (p) => {
@@ -369,7 +369,7 @@ class Request extends BaseRequest {
369
369
  }
370
370
  const param = this.parameters[name]
371
371
  if (param.io === 1 || (param.io === 2 && param.value)) {
372
- params.push(castParameter(param.value, param.type, param))
372
+ params.push(castParameter(param.value, param.type))
373
373
  }
374
374
  }
375
375
 
package/lib/table.js CHANGED
@@ -99,7 +99,7 @@ Table.prototype._makeBulk = function _makeBulk () {
99
99
  }
100
100
 
101
101
  Table.prototype.declare = function declare () {
102
- const pkey = this.columns.filter(col => col.primary === true).map(col => col.name)
102
+ const pkey = this.columns.filter(col => col.primary === true).map(col => `[${col.name}]`)
103
103
  const cols = this.columns.map(col => {
104
104
  const def = [`[${col.name}] ${declareType(col.type, col)}`]
105
105
 
@@ -116,7 +116,7 @@ Table.prototype.declare = function declare () {
116
116
  return def.join(' ')
117
117
  })
118
118
 
119
- const constraint = pkey.length > 1 ? `, constraint PK_${this.temporary ? this.name.substr(1) : this.name} primary key (${pkey.join(', ')})` : ''
119
+ const constraint = pkey.length > 1 ? `, constraint [PK_${this.temporary ? this.name.substr(1) : this.name}] primary key (${pkey.join(', ')})` : ''
120
120
  return `create table ${this.path} (${cols.join(', ')}${constraint})`
121
121
  }
122
122
 
@@ -37,7 +37,7 @@ class ConnectionPool extends BaseConnectionPool {
37
37
  cfg.options.database = cfg.options.database || this.config.database
38
38
  cfg.options.port = cfg.options.port || this.config.port
39
39
  cfg.options.connectTimeout = cfg.options.connectTimeout || this.config.connectionTimeout || this.config.timeout || 15000
40
- cfg.options.requestTimeout = cfg.options.requestTimeout || this.config.requestTimeout != null ? this.config.requestTimeout : 15000
40
+ cfg.options.requestTimeout = cfg.options.requestTimeout || this.config.requestTimeout || this.config.timeout || 15000
41
41
  cfg.options.tdsVersion = cfg.options.tdsVersion || '7_4'
42
42
  cfg.options.rowCollectionOnDone = cfg.options.rowCollectionOnDone || false
43
43
  cfg.options.rowCollectionOnRequestCompletion = cfg.options.rowCollectionOnRequestCompletion || false
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "azure",
22
22
  "node-mssql"
23
23
  ],
24
- "version": "8.1.0",
24
+ "version": "8.1.3",
25
25
  "main": "index.js",
26
26
  "repository": "github:tediousjs/node-mssql",
27
27
  "license": "MIT",