Node-mssql: Option to return smaller payload which will reduce size by more than half

Created on 23 Jul 2019  路  4Comments  路  Source: tediousjs/node-mssql

Currently, when performing any request, the payload is as follows based on the docs:

Current Situation:

result: {
   recordsets,
   recordset,
   returnValue
   output,
   rowsAffected
}

In our scenario, sql.query is being called via a Web API. This means that the HTTP payload is double the size due to the recordsets and recordset properties.

Suggestion:

In most cases, only the recordset is required. Can a config property not be added, to only return a lite version of the payload, which is essentially just the data in recordset?

i.e. The full payload is returned by default, but if set, a lite version can be returned, reducing the size of the payload significantly.

Software versions

  • NodeJS:
  • node-mssql:
  • SQL Server:
discussion

Most helpful comment

The transfer of data from an SQL server and an application server is not sent over HTTP.

The SQL server doesn't respond in the result format, that is constructed by us from the TDS stream we get and is constructed by the application server. No duplication data is sent from the SQL Server to the application server to construct our result object.

Thank you. That is actually very insightful and aided my understanding of your module 馃檹.

All 4 comments

In the nicest way, there is absolutely no sensible scenario where one should be dumping out the result of a direct SQL query.

Why don't you just modify the results of the query before responding with some payload, that has hopefully been sanitised or checked for safety?

I kind of hope you have this in place on your web API otherwise I'm very concerned about your API's security setup.

Hi Will. Yes the Web API's logic does perform necessary checks, modifications, etc. It's the transportation of data between the SQL server and the Web API provider that I'm referring to.

Nonetheless, thanks for at least responding to my request.

The transfer of data from an SQL server and an application server is not sent over HTTP.

The SQL server doesn't respond in the result format, that is constructed by us from the TDS stream we get and is constructed by the application server. No duplication of data is sent from the SQL Server to the application server to construct our result object.

The transfer of data from an SQL server and an application server is not sent over HTTP.

The SQL server doesn't respond in the result format, that is constructed by us from the TDS stream we get and is constructed by the application server. No duplication data is sent from the SQL Server to the application server to construct our result object.

Thank you. That is actually very insightful and aided my understanding of your module 馃檹.

Was this page helpful?
0 / 5 - 0 ratings