I am using the mssql npm library which is working, but I am struggling to get the recordset returned from the sub-level callback.
How do I get the recordset back when it's multiple layers of callback?
let storedRecordset = await doQuery();
async function doQuery(){
     let recordset;
     const ps = new sql.PreparedStatement(/* [pool] */)
     ps.input('param', sql.Int)
     ps.prepare('select @param as value', err => {
         // ... error checks
         ps.execute({param: 12345}, (err, result) => {
             // ... error checks
 
             recordset = result;        
     
             // release the connection after queries are executed
             ps.unprepare(err => {
                 // ... error checks
                 return recordset;
             })
         })
     })
}
Thanks
 
    