mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-21 13:35:19 -05:00
Fix #2504
This commit is contained in:
parent
28c3291020
commit
39ac9b887e
@ -248,19 +248,19 @@ exports.dnsResolve = function (hostname, resolverServer, resolverPort, rrtype) {
|
|||||||
* @param {string} query The query to validate the database with
|
* @param {string} query The query to validate the database with
|
||||||
* @returns {Promise<(string[]|Object[]|Object)>}
|
* @returns {Promise<(string[]|Object[]|Object)>}
|
||||||
*/
|
*/
|
||||||
exports.mssqlQuery = function (connectionString, query) {
|
exports.mssqlQuery = async function (connectionString, query) {
|
||||||
return new Promise((resolve, reject) => {
|
let pool;
|
||||||
mssql.connect(connectionString).then(pool => {
|
try {
|
||||||
return pool.request()
|
pool = new mssql.ConnectionPool(connectionString);
|
||||||
.query(query);
|
await pool.connect();
|
||||||
}).then(result => {
|
await pool.request().query(query);
|
||||||
resolve(result);
|
pool.close();
|
||||||
}).catch(err => {
|
} catch (e) {
|
||||||
reject(err);
|
if (pool) {
|
||||||
}).finally(() => {
|
pool.close();
|
||||||
mssql.close();
|
}
|
||||||
});
|
throw e;
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user