node-sqlserver-v8
node-sqlserver-v8 copied to clipboard
More code samples for Multiple Result Sets (like issue 113)
While the resolution to issue #113 technically speaks to my problem, I'm just calling my stored proc in the context of a regular query issued from a pool, and cannot figure out how to adapt the example you gave in #113 that uses the ProcedureManager
let multiResultSqlStatement = `dbo.sp_help [SomeTable]`;
const poolPromise = configObj.pools['MyNamedPool'].connect();
let records = await poolPromise.then((pool) => {
return pool.query(multiResultSqlStatement);
}).then(result=>{
return result;
}).catch(err=>{
console.log(err);
});
I need to know either: A. How to use pools together with ProcedureManager or B. an expanded code snippet showing how to detect the additional results using query
I am not using the native pools, fwiw, but rather the ones from mssql package.
configuration.pools = {};
configuration.pools["pool_1"] = new sql.ConnectionPool({ //https://www.npmjs.com/package/mssql#connection-pools
connectionString: configuration.connectionString1,
options:{trustedConnection:true}
});
configuration.pools["pool_2"] = new sql.ConnectionPool({
connectionString: configuration.connectionString2,
options:{trustedConnection:true}
});
return configuration;