mssql 7.3.0 → 7.3.1
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 +8 -0
- package/LICENSE.md +22 -22
- package/bin/mssql +0 -0
- package/lib/cli.js +113 -113
- package/lib/isolationlevel.js +9 -9
- package/package.json +2 -2
- package/test.js +0 -40
package/CHANGELOG.txt
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
v7.3.1 (2022-02-24)
|
|
2
|
+
-------------------
|
|
3
|
+
[fix] Bump debug dependency ([#1361](https://github.com/tediousjs/node-mssql/pull/1361))
|
|
4
|
+
|
|
1
5
|
v7.3.0 (2021-11-18)
|
|
2
6
|
-------------------
|
|
3
7
|
[new] Transaction/PreparedStatements expose the config from their parent connection
|
|
@@ -49,6 +53,10 @@ v7.0.0 (2021-05-06)
|
|
|
49
53
|
[fix] Connection config objects are now deep cloned when stored against a connection pool ([#1217](https://github.com/tediousjs/node-mssql/pull/1217))
|
|
50
54
|
[removed] Support for connection uri format has been removed (eg: `mssql://user:password@host/?params=values`)
|
|
51
55
|
|
|
56
|
+
v6.4.1 (2022-02-24)
|
|
57
|
+
-------------------
|
|
58
|
+
[fix] Bump debug dependency ([#1361](https://github.com/tediousjs/node-mssql/pull/1361))
|
|
59
|
+
|
|
52
60
|
v6.4.0 (2021-11-18)
|
|
53
61
|
-------------------
|
|
54
62
|
[new] Transaction/PreparedStatements expose the config from their parent connection
|
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/bin/mssql
CHANGED
|
File without changes
|
package/lib/cli.js
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const sql = require('./tedious')
|
|
6
|
-
|
|
7
|
-
const exit = process.exit
|
|
8
|
-
const write = text => process.stdout.write(text)
|
|
9
|
-
Buffer.prototype.toJSON = () => {
|
|
10
|
-
return `0x${this.toString('hex')}`
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Resolve config path
|
|
14
|
-
|
|
15
|
-
let cfgPath = path.resolve(process.argv[2] || process.cwd())
|
|
16
|
-
if (fs.lstatSync(cfgPath).isDirectory()) {
|
|
17
|
-
cfgPath = path.resolve(cfgPath, './.mssql.json')
|
|
18
|
-
}
|
|
19
|
-
if (!fs.existsSync(cfgPath)) {
|
|
20
|
-
console.error('Config file not found.')
|
|
21
|
-
exit(1)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Config checks & parse
|
|
25
|
-
|
|
26
|
-
let config
|
|
27
|
-
try {
|
|
28
|
-
config = fs.readFileSync(cfgPath)
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error(`Failed to load config file. ${err.message}`)
|
|
31
|
-
exit(1)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
config = JSON.parse(config)
|
|
36
|
-
} catch (err) {
|
|
37
|
-
console.error(`Failed to parse config file. ${err.message}`)
|
|
38
|
-
exit(1)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Read stdin
|
|
42
|
-
|
|
43
|
-
const buffer = []
|
|
44
|
-
|
|
45
|
-
process.stdin.setEncoding('utf8')
|
|
46
|
-
process.stdin.on('readable', () => buffer.push(process.stdin.read()))
|
|
47
|
-
|
|
48
|
-
process.stdin.on('end', () => {
|
|
49
|
-
const statement = buffer.join('')
|
|
50
|
-
let rst = 0
|
|
51
|
-
let index = 0
|
|
52
|
-
|
|
53
|
-
if (!statement.length) {
|
|
54
|
-
console.error('Statement is empty.')
|
|
55
|
-
exit(1)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
sql.connect(config, err => {
|
|
59
|
-
if (err) {
|
|
60
|
-
console.error(err.message)
|
|
61
|
-
exit(1)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
write('[')
|
|
65
|
-
|
|
66
|
-
const request = new sql.Request()
|
|
67
|
-
request.stream = true
|
|
68
|
-
request.on('recordset', () => {
|
|
69
|
-
index = 0
|
|
70
|
-
if (rst++ > 0) {
|
|
71
|
-
write('],')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return write('[')
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
request.on('error', err => {
|
|
78
|
-
console.error(err.message)
|
|
79
|
-
sql.close()
|
|
80
|
-
return exit(1)
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
request.on('row', row => {
|
|
84
|
-
if (index++ > 0) {
|
|
85
|
-
write(',')
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return write(JSON.stringify(row))
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
request.on('done', () => {
|
|
92
|
-
if (rst > 0) {
|
|
93
|
-
write(']')
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
write(']\n')
|
|
97
|
-
sql.close()
|
|
98
|
-
return exit(0)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
request.query(statement)
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
process.on('uncaughtException', err => {
|
|
106
|
-
if (err.code === 'EPIPE') {
|
|
107
|
-
console.error('Failed to pipe output stream.')
|
|
108
|
-
} else {
|
|
109
|
-
console.error(err.message)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
exit(1)
|
|
113
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const sql = require('./tedious')
|
|
6
|
+
|
|
7
|
+
const exit = process.exit
|
|
8
|
+
const write = text => process.stdout.write(text)
|
|
9
|
+
Buffer.prototype.toJSON = () => {
|
|
10
|
+
return `0x${this.toString('hex')}`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Resolve config path
|
|
14
|
+
|
|
15
|
+
let cfgPath = path.resolve(process.argv[2] || process.cwd())
|
|
16
|
+
if (fs.lstatSync(cfgPath).isDirectory()) {
|
|
17
|
+
cfgPath = path.resolve(cfgPath, './.mssql.json')
|
|
18
|
+
}
|
|
19
|
+
if (!fs.existsSync(cfgPath)) {
|
|
20
|
+
console.error('Config file not found.')
|
|
21
|
+
exit(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Config checks & parse
|
|
25
|
+
|
|
26
|
+
let config
|
|
27
|
+
try {
|
|
28
|
+
config = fs.readFileSync(cfgPath)
|
|
29
|
+
} catch (err) {
|
|
30
|
+
console.error(`Failed to load config file. ${err.message}`)
|
|
31
|
+
exit(1)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
config = JSON.parse(config)
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error(`Failed to parse config file. ${err.message}`)
|
|
38
|
+
exit(1)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Read stdin
|
|
42
|
+
|
|
43
|
+
const buffer = []
|
|
44
|
+
|
|
45
|
+
process.stdin.setEncoding('utf8')
|
|
46
|
+
process.stdin.on('readable', () => buffer.push(process.stdin.read()))
|
|
47
|
+
|
|
48
|
+
process.stdin.on('end', () => {
|
|
49
|
+
const statement = buffer.join('')
|
|
50
|
+
let rst = 0
|
|
51
|
+
let index = 0
|
|
52
|
+
|
|
53
|
+
if (!statement.length) {
|
|
54
|
+
console.error('Statement is empty.')
|
|
55
|
+
exit(1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
sql.connect(config, err => {
|
|
59
|
+
if (err) {
|
|
60
|
+
console.error(err.message)
|
|
61
|
+
exit(1)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
write('[')
|
|
65
|
+
|
|
66
|
+
const request = new sql.Request()
|
|
67
|
+
request.stream = true
|
|
68
|
+
request.on('recordset', () => {
|
|
69
|
+
index = 0
|
|
70
|
+
if (rst++ > 0) {
|
|
71
|
+
write('],')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return write('[')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
request.on('error', err => {
|
|
78
|
+
console.error(err.message)
|
|
79
|
+
sql.close()
|
|
80
|
+
return exit(1)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
request.on('row', row => {
|
|
84
|
+
if (index++ > 0) {
|
|
85
|
+
write(',')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return write(JSON.stringify(row))
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
request.on('done', () => {
|
|
92
|
+
if (rst > 0) {
|
|
93
|
+
write(']')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
write(']\n')
|
|
97
|
+
sql.close()
|
|
98
|
+
return exit(0)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
request.query(statement)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
process.on('uncaughtException', err => {
|
|
106
|
+
if (err.code === 'EPIPE') {
|
|
107
|
+
console.error('Failed to pipe output stream.')
|
|
108
|
+
} else {
|
|
109
|
+
console.error(err.message)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
exit(1)
|
|
113
|
+
})
|
package/lib/isolationlevel.js
CHANGED
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"azure",
|
|
22
22
|
"node-mssql"
|
|
23
23
|
],
|
|
24
|
-
"version": "7.3.
|
|
24
|
+
"version": "7.3.1",
|
|
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.3.0",
|
|
30
|
-
"debug": "^4.3.
|
|
30
|
+
"debug": "^4.3.3",
|
|
31
31
|
"rfdc": "^1.3.0",
|
|
32
32
|
"tarn": "^3.0.1",
|
|
33
33
|
"tedious": "^11.4.0"
|
package/test.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const mssql = require('./')
|
|
3
|
-
|
|
4
|
-
const [, , max] = process.argv
|
|
5
|
-
|
|
6
|
-
const sqlConfig = {
|
|
7
|
-
password: 'P@ssw0rd',
|
|
8
|
-
database: 'test',
|
|
9
|
-
stream: false,
|
|
10
|
-
// driver: 'msnodesqlv8',
|
|
11
|
-
options: {
|
|
12
|
-
trustServerCertificate: true,
|
|
13
|
-
enableArithAbort: true,
|
|
14
|
-
encrypt: true,
|
|
15
|
-
abortTransactionOnError: false
|
|
16
|
-
},
|
|
17
|
-
pool: {
|
|
18
|
-
max: max ? parseInt(max) : 10,
|
|
19
|
-
min: 0
|
|
20
|
-
},
|
|
21
|
-
port: 1433,
|
|
22
|
-
user: 'sa',
|
|
23
|
-
server: 'localhost',
|
|
24
|
-
arrayRowMode: true
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
mssql.connect(sqlConfig).then((pool) => {
|
|
28
|
-
console.log('Connected to SQL server')
|
|
29
|
-
const request = pool.request()
|
|
30
|
-
request.stream = true
|
|
31
|
-
request.on('error', (err) => {
|
|
32
|
-
console.error('good', err)
|
|
33
|
-
})
|
|
34
|
-
return request.query('SELECT * FROM nontable')
|
|
35
|
-
}).catch((err) => {
|
|
36
|
-
console.error('bad', err)
|
|
37
|
-
}).then(() => {
|
|
38
|
-
console.log('Disconnecting from SQL server')
|
|
39
|
-
return mssql.close()
|
|
40
|
-
}).then(() => console.log('Disconnected'))
|