TDS SQL Querying: Asynchronous Approach
I'm using: Node.js, MS-SQL, tedious TDS implementation for Node.js
Essentially, I have an array of items. I need to lookup each item in an
SQL-based database via TDS protocol and
Extract column data for each item
Identify items which arn't found in the database
The problem is that the queries are asynchronous in the sense that I need
to wait for the response of a query before sending the next one. So my
options are:
Wait. Wait for each query-response for each item in the array to execute
back-to-back.
Do something like SELECT <cols> FROM <table> WHERE <key> IN <the array> to
do a single query, then leave it up to me to efficiently try to match
items in my array to returned rows
Something better?
Thoughts? Ideally I'd like an asynchronous solution where I can send off a
query for each item in the array at the same time, process separate
request as they come in, and continue once all request-response pairs are
completed.
No comments:
Post a Comment