|
|
|
@ -248,19 +248,19 @@ exports.dnsResolve = function (hostname, resolverServer, resolverPort, rrtype) {
|
|
|
|
|
* @param {string} query The query to validate the database with
|
|
|
|
|
* @returns {Promise<(string[]|Object[]|Object)>}
|
|
|
|
|
*/
|
|
|
|
|
exports.mssqlQuery = function (connectionString, query) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
mssql.connect(connectionString).then(pool => {
|
|
|
|
|
return pool.request()
|
|
|
|
|
.query(query);
|
|
|
|
|
}).then(result => {
|
|
|
|
|
resolve(result);
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
reject(err);
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
mssql.close();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
exports.mssqlQuery = async function (connectionString, query) {
|
|
|
|
|
let pool;
|
|
|
|
|
try {
|
|
|
|
|
pool = new mssql.ConnectionPool(connectionString);
|
|
|
|
|
await pool.connect();
|
|
|
|
|
await pool.request().query(query);
|
|
|
|
|
pool.close();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (pool) {
|
|
|
|
|
pool.close();
|
|
|
|
|
}
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|