mutilple queries to DB using nodesql 8 and mssqlnodev8 for SQLServer DB

114 views
Skip to first unread message

Lucky Jindal

unread,
Jul 17, 2018, 2:52:13 AM7/17/18
to nodejs
Hi 
 
I have a usecase where I have to execute multiple select queries with different params to same table/DB. So bascially same query with different params

so I formed an array of queries. Number of queries would be dynamic. 

Now I want to run those  parallel or sequence is also okay, and want to fetch results back in array or map.
I am using msnodev8sql drivers to make connection and using connection pooling.
I tried different ways , adding {multipleStatements: true} to db config but did not work.
First select statement runs and thats all. 
Tried tedious-connection-pool and other ways but failed with errors.Can someone point me in the right direction or tell me if its possible or not. 


Basic API/modules I use -

var sql = require('mssql/msnodesqlv8')
var cp = sql.ConnectionPool(dbConfig)

var req = new sql.Request(cp);
cp.connect().then(function(){.. req.query().then()......})

Above, I tried different variations like tedious connection pool or multiple statements: true or even preparedStatements. 
Reply all
Reply to author
Forward
0 new messages