mssql 6.3.1 → 6.3.2

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,7 @@
1
+ v6.3.2 (2021-05-13)
2
+ -------------------
3
+ [fix] Bump various dependencies for security fixes
4
+
1
5
  v6.3.1 (2021-01-01)
2
6
  -------------------
3
7
  [fix] Ensure line endings are unix style (LF)
@@ -63,6 +67,10 @@ v6.0.0 (2019-11-05)
63
67
  [change] Replaced pool library (`generic-pool`) with `tarn.js` ([#808](https://github.com/tediousjs/node-mssql/pull/808))
64
68
  [removed] Backoff try strategy for creating connections removed, `tarn.js` built-in retry strategy used instead
65
69
 
70
+ v5.1.5 (2021-05-13)
71
+ -------------------
72
+ [fix] Bump various dependencies for security fixes
73
+
66
74
  v5.1.4 (2021-01-01)
67
75
  -------------------
68
76
  [fix] Ensure line endings are unix style (LF)
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
+ })
@@ -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,7 +21,7 @@
21
21
  "azure",
22
22
  "node-mssql"
23
23
  ],
24
- "version": "6.3.1",
24
+ "version": "6.3.2",
25
25
  "main": "index.js",
26
26
  "repository": "github:tediousjs/node-mssql",
27
27
  "license": "MIT",
package/test.js CHANGED
@@ -1,40 +1,40 @@
1
- 'use strict'
2
- const mssql = require('./')
3
- const { v4: uuid } = require('uuid')
4
-
5
- const [, , max] = process.argv;
6
-
7
- const sqlConfig = {
8
- password: 'Upper_l0wercase',
9
- database: 'di_production',
10
- stream: false,
11
- // driver: 'msnodesqlv8',
12
- options: {
13
- // trustedConnection: true,
14
- trustServerCertificate: true,
15
- enableArithAbort: true,
16
- encrypt: true,
17
- // abortTransactionOnError: false,
18
- },
19
- pool: {
20
- max: max ? parseInt(max) : 10,
21
- min: 0,
22
- },
23
- port: 1433,
24
- user: 'sa',
25
- server: 'localhost',
26
- };
27
-
28
- (async () => {
29
- const pools = await Promise.all(Array.from(new Array(100)).map(() => {
30
- return new mssql.ConnectionPool(sqlConfig).connect()
31
- }))
32
- setInterval(async () => {
33
- const pool = pools[Math.floor(Math.random() * pools.length)]
34
- const ps = new mssql.PreparedStatement(pool)
35
- ps.input('tempParam', mssql.TYPES.NVarChar)
36
- await ps.prepare('SELECT TOP 10 * FROM [debug] WHERE [tempData] = @tempParam')
37
- await ps.execute({ tempParam: '{}' })
38
- await ps.unprepare()
39
- }, 100)
40
- })()
1
+ 'use strict'
2
+
3
+ const mssql = require('./')
4
+ const wtf = require('wtfnode');
5
+
6
+ const sqlConfig = {
7
+ password: '&r8wrucH',
8
+ database: 'StockDB',
9
+ stream: false,
10
+ options: {
11
+ // trustServerCertificate: true,
12
+ enableArithAbort: true,
13
+ encrypt: true,
14
+ abortTransactionOnError: false,
15
+ },
16
+ pool: {
17
+ max: 1,
18
+ min: 0,
19
+ },
20
+ port: 1433,
21
+ user: 'dhensby',
22
+ server: '4sa.database.windows.net',
23
+ }
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...');
29
+
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
+ });
package/test2.js DELETED
@@ -1,211 +0,0 @@
1
- const values = [
2
- 1810,
3
- 1729,
4
- 1857,
5
- 1777,
6
- 1927,
7
- 1936,
8
- 1797,
9
- 1719,
10
- 1703,
11
- 1758,
12
- 1768,
13
- 2008,
14
- 1963,
15
- 1925,
16
- 1919,
17
- 1911,
18
- 1782,
19
- 2001,
20
- 1744,
21
- 1738,
22
- 1742,
23
- 1799,
24
- 1765,
25
- 1819,
26
- 1888,
27
- 127,
28
- 1880,
29
- 1984,
30
- 1697,
31
- 1760,
32
- 1680,
33
- 1951,
34
- 1745,
35
- 1817,
36
- 1704,
37
- 1736,
38
- 1969,
39
- 1705,
40
- 1690,
41
- 1848,
42
- 1885,
43
- 1912,
44
- 1982,
45
- 1895,
46
- 1959,
47
- 1769,
48
- 1722,
49
- 1807,
50
- 1901,
51
- 1983,
52
- 1993,
53
- 1871,
54
- 1795,
55
- 1955,
56
- 1921,
57
- 1934,
58
- 1743,
59
- 1899,
60
- 1942,
61
- 1964,
62
- 1034,
63
- 1952,
64
- 1851,
65
- 1716,
66
- 1800,
67
- 1771,
68
- 1945,
69
- 1877,
70
- 1917,
71
- 1930,
72
- 1970,
73
- 1948,
74
- 1914,
75
- 1767,
76
- 1910,
77
- 563,
78
- 1121,
79
- 1897,
80
- 1946,
81
- 1882,
82
- 1739,
83
- 1900,
84
- 1714,
85
- 1931,
86
- 2000,
87
- 311,
88
- 1881,
89
- 1876,
90
- 354,
91
- 1965,
92
- 1842,
93
- 1979,
94
- 1998,
95
- 1960,
96
- 1852,
97
- 1847,
98
- 1938,
99
- 1369,
100
- 1780,
101
- 1698,
102
- 1753,
103
- 1746,
104
- 1868,
105
- 1752,
106
- 1802,
107
- 1892,
108
- 1755,
109
- 1818,
110
- 1913,
111
- 1706,
112
- 1862,
113
- 326,
114
- 1941,
115
- 1926,
116
- 1809,
117
- 1879,
118
- 1815,
119
- 1939,
120
- 1859,
121
- 1999,
122
- 1947,
123
- 1898,
124
- 1794,
125
- 1737,
126
- 1971,
127
- 1977,
128
- 1944,
129
- 1812,
130
- 1905,
131
- 1359,
132
- 1788,
133
- 1754,
134
- 1774,
135
- 1825,
136
- 1748,
137
- 1701,
138
- 1791,
139
- 1786,
140
- 1692,
141
- 1894,
142
- 1961,
143
- 1902,
144
- 1849,
145
- 1967,
146
- 1770,
147
- 1987,
148
- 1831,
149
- 1728,
150
- 1896,
151
- 1805,
152
- 1733,
153
- 1918,
154
- 1731,
155
- 661,
156
- 1776,
157
- 1494,
158
- 2005,
159
- 2009,
160
- 2004,
161
- 1915,
162
- 1695,
163
- 1710,
164
- 1804,
165
- 1929,
166
- 1725,
167
- 1772,
168
- 1933,
169
- 609,
170
- 1708,
171
- 1822,
172
- 1978,
173
- 1811,
174
- 1816,
175
- 1073,
176
- 1874,
177
- 1845,
178
- 1989,
179
- 1696,
180
- 1953,
181
- 1823,
182
- 1923,
183
- 1907,
184
- 1834,
185
- 1806,
186
- 1861,
187
- 1785,
188
- 297,
189
- 1968,
190
- 1764,
191
- 1932,
192
- 1937,
193
- 1826,
194
- 1732,
195
- 1962,
196
- 1916,
197
- 1756,
198
- 1975,
199
- 1775,
200
- 1922,
201
- 1773
202
- ]
203
-
204
- values.forEach((first) => {
205
- values.forEach((second) => {
206
- const third = 2020 - first - second
207
- if (values.includes(third)) {
208
- console.log(first * second * third)
209
- }
210
- })
211
- })