mssql
Advanced tools
Comparing version 6.3.1 to 6.3.2
@@ -0,1 +1,5 @@ | ||
v6.3.2 (2021-05-13) | ||
------------------- | ||
[fix] Bump various dependencies for security fixes | ||
v6.3.1 (2021-01-01) | ||
@@ -66,2 +70,6 @@ ------------------- | ||
v5.1.5 (2021-05-13) | ||
------------------- | ||
[fix] Bump various dependencies for security fixes | ||
v5.1.4 (2021-01-01) | ||
@@ -68,0 +76,0 @@ ------------------- |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -0,0 +0,0 @@ MIT License |
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "6.3.1", | ||
"version": "6.3.2", | ||
"main": "index.js", | ||
@@ -27,0 +27,0 @@ "repository": "github:tediousjs/node-mssql", |
52
test.js
'use strict' | ||
const mssql = require('./') | ||
const { v4: uuid } = require('uuid') | ||
const wtf = require('wtfnode'); | ||
const [, , max] = process.argv; | ||
const sqlConfig = { | ||
password: 'Upper_l0wercase', | ||
database: 'di_production', | ||
password: '&r8wrucH', | ||
database: 'StockDB', | ||
stream: false, | ||
// driver: 'msnodesqlv8', | ||
options: { | ||
// trustedConnection: true, | ||
trustServerCertificate: true, | ||
// trustServerCertificate: true, | ||
enableArithAbort: true, | ||
encrypt: true, | ||
// abortTransactionOnError: false, | ||
abortTransactionOnError: false, | ||
}, | ||
pool: { | ||
max: max ? parseInt(max) : 10, | ||
max: 1, | ||
min: 0, | ||
}, | ||
port: 1433, | ||
user: 'sa', | ||
server: 'localhost', | ||
}; | ||
user: 'dhensby', | ||
server: '4sa.database.windows.net', | ||
} | ||
(async () => { | ||
const pools = await Promise.all(Array.from(new Array(100)).map(() => { | ||
return new mssql.ConnectionPool(sqlConfig).connect() | ||
})) | ||
setInterval(async () => { | ||
const pool = pools[Math.floor(Math.random() * pools.length)] | ||
const ps = new mssql.PreparedStatement(pool) | ||
ps.input('tempParam', mssql.TYPES.NVarChar) | ||
await ps.prepare('SELECT TOP 10 * FROM [debug] WHERE [tempData] = @tempParam') | ||
await ps.execute({ tempParam: '{}' }) | ||
await ps.unprepare() | ||
}, 100) | ||
})() | ||
// Bad URI, connection timeouts, hangs process | ||
mssql.connect({ ...sqlConfig, port: 2345 }).catch(err => { | ||
console.error(err.message); | ||
console.log('reconnecting...'); | ||
// Try to connect using the right URI | ||
return mssql | ||
.connect(sqlConfig) | ||
.then(() => console.log('connected')) | ||
.then(() => mssql.close()) | ||
.then(() => console.log('closed')) | ||
.catch(err => { | ||
console.error(err.message) | ||
wtf.dump() | ||
}); // <-- Fails here | ||
}); |
240576
37
4708