mssql 6.2.2 → 6.2.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 +5 -0
- package/README.md +2 -2
- package/lib/global-connection.js +12 -1
- package/lib/msnodesqlv8/request.js +14 -18
- package/package.json +1 -1
- package/test.js +20 -23
package/CHANGELOG.txt
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
v6.2.3 (2020-09-25)
|
|
2
|
+
-------------------
|
|
3
|
+
[fix] Remove reference to global pool on connection error ([#1107](https://github.com/tediousjs/node-mssql/pull/1107))
|
|
4
|
+
[fix] Trailing rows from request streams using msnodesqlv8 driver fail to be emitted ([#1109](https://github.com/tediousjs/node-mssql/pull/1109))
|
|
5
|
+
|
|
1
6
|
v6.2.2 (2020-09-18)
|
|
2
7
|
-------------------
|
|
3
8
|
[fix] Avoid using deprecated `.inspect` on Objects ([#1071](https://github.com/tediousjs/node-mssql/pull/1071))
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Microsoft SQL Server client for Node.js
|
|
|
6
6
|
|
|
7
7
|
Supported TDS drivers:
|
|
8
8
|
- [Tedious][tedious-url] (pure JavaScript - Windows/macOS/Linux, default)
|
|
9
|
-
- [Microsoft / Contributors Node V8 Driver for Node.js for SQL Server][msnodesqlv8-url] (native - Windows only)
|
|
9
|
+
- [Microsoft / Contributors Node V8 Driver for Node.js for SQL Server][msnodesqlv8-url] (native - Windows/Linux only)
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -658,7 +658,7 @@ More information about Tedious specific options: http://tediousjs.github.io/tedi
|
|
|
658
658
|
|
|
659
659
|
### Microsoft / Contributors Node V8 Driver for Node.js for SQL Server
|
|
660
660
|
|
|
661
|
-
**Requires Node.js
|
|
661
|
+
**Requires Node.js v10+ or newer. Windows/Linux only.** This driver is not part of the default package and must be installed separately by `npm install msnodesqlv8`. To use this driver, use this require syntax: `const sql = require('mssql/msnodesqlv8')`.
|
|
662
662
|
|
|
663
663
|
**Extra options:**
|
|
664
664
|
|
package/lib/global-connection.js
CHANGED
|
@@ -48,7 +48,18 @@ function connect (config, callback) {
|
|
|
48
48
|
|
|
49
49
|
globalConnection.close = globalClose.bind(globalConnection)
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
if (typeof callback === 'function') {
|
|
52
|
+
return globalConnection.connect((err, connection) => {
|
|
53
|
+
if (err) {
|
|
54
|
+
globalConnection = null
|
|
55
|
+
}
|
|
56
|
+
callback(err, connection)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
return globalConnection.connect().catch((err) => {
|
|
60
|
+
globalConnection = null
|
|
61
|
+
return shared.Promise.reject(err)
|
|
62
|
+
})
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
/**
|
|
@@ -396,11 +396,10 @@ class Request extends BaseRequest {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
chunksBuffer = null
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (this.stream && !this.paused) this.emit('row', row)
|
|
399
|
+
if (row && row.___return___ == null) {
|
|
400
|
+
// row with ___return___ col is the last row
|
|
401
|
+
if (this.stream && !this.paused) this.emit('row', row)
|
|
402
|
+
}
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
405
|
|
|
@@ -436,14 +435,7 @@ class Request extends BaseRequest {
|
|
|
436
435
|
})
|
|
437
436
|
|
|
438
437
|
req.on('row', rownumber => {
|
|
439
|
-
if (row)
|
|
440
|
-
if (isChunkedRecordset) return
|
|
441
|
-
|
|
442
|
-
if (row.___return___ == null) {
|
|
443
|
-
// row with ___return___ col is the last row
|
|
444
|
-
if (this.stream && !this.paused) this.emit('row', row)
|
|
445
|
-
}
|
|
446
|
-
}
|
|
438
|
+
if (row && isChunkedRecordset) return
|
|
447
439
|
|
|
448
440
|
row = {}
|
|
449
441
|
|
|
@@ -466,6 +458,11 @@ class Request extends BaseRequest {
|
|
|
466
458
|
} else {
|
|
467
459
|
row[columns[idx].name] = data
|
|
468
460
|
}
|
|
461
|
+
if (row.___return___ == null) {
|
|
462
|
+
if (this.stream && !this.paused && idx === columns.length - 1) {
|
|
463
|
+
this.emit('row', row)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
469
466
|
}
|
|
470
467
|
})
|
|
471
468
|
|
|
@@ -525,11 +522,10 @@ class Request extends BaseRequest {
|
|
|
525
522
|
}
|
|
526
523
|
|
|
527
524
|
chunksBuffer = null
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (this.stream && !this.paused) { this.emit('row', row) }
|
|
525
|
+
if (row && row.___return___ == null) {
|
|
526
|
+
// row with ___return___ col is the last row
|
|
527
|
+
if (this.stream && !this.paused) { this.emit('row', row) }
|
|
528
|
+
}
|
|
533
529
|
}
|
|
534
530
|
}
|
|
535
531
|
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const mssql = require('./')
|
|
4
|
+
const wtf = require('wtfnode');
|
|
4
5
|
|
|
5
6
|
const sqlConfig = {
|
|
6
|
-
password: '
|
|
7
|
+
password: '&r8wrucH',
|
|
7
8
|
database: 'StockDB',
|
|
8
9
|
stream: false,
|
|
9
10
|
options: {
|
|
10
|
-
trustServerCertificate: true,
|
|
11
|
+
// trustServerCertificate: true,
|
|
11
12
|
enableArithAbort: true,
|
|
12
13
|
encrypt: true,
|
|
13
14
|
abortTransactionOnError: false,
|
|
@@ -17,27 +18,23 @@ const sqlConfig = {
|
|
|
17
18
|
min: 0,
|
|
18
19
|
},
|
|
19
20
|
port: 1433,
|
|
20
|
-
user: '
|
|
21
|
-
server: '
|
|
21
|
+
user: 'dhensby',
|
|
22
|
+
server: '4sa.database.windows.net',
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
// Bad URI, connection timeouts, hangs process
|
|
26
|
+
mssql.connect({ ...sqlConfig, port: 2345 }).catch(err => {
|
|
27
|
+
console.error(err.message);
|
|
28
|
+
console.log('reconnecting...');
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.timeEnd('query')
|
|
38
|
-
} finally {
|
|
39
|
-
await client.close()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
run()
|
|
30
|
+
// Try to connect using the right URI
|
|
31
|
+
return mssql
|
|
32
|
+
.connect(sqlConfig)
|
|
33
|
+
.then(() => console.log('connected'))
|
|
34
|
+
.then(() => mssql.close())
|
|
35
|
+
.then(() => console.log('closed'))
|
|
36
|
+
.catch(err => {
|
|
37
|
+
console.error(err.message)
|
|
38
|
+
wtf.dump()
|
|
39
|
+
}); // <-- Fails here
|
|
40
|
+
});
|