tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 467 forks source link

Multiple select statements stream #1449

Closed huytool157 closed 1 year ago

huytool157 commented 1 year ago

Say I want to query this sql query that contains multiple select statements using stream

select * from users; select * from organizations

Since we're using stream, each row got returned one by one. How do we know if row X is a result from the first or second select statement?

Expected behaviour:

Actual behaviour:

Configuration:

// paste relevant config here

Software versions

dhensby commented 1 year ago

This isn't really an ideal use case for streams; you should run two separate streams.

However, the request object will emit a recordset event with the columns as the argument every time it encounters a new recordset (ie: query).