-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sql Server FOR JSON support #317
Comments
Since it seems to be a popular platform for tedious users, just wanted to note that FOR JSON is available in SQL Azure as well. https://azure.microsoft.com/en-us/blog/json-functionalities-in-azure-sql-database-public-preview/ Built in handling for tedious would be a great addition. |
Interesting thing is that node-mssql has JSON support only if it is used with tedious: http://patriksimek.github.io/node-mssql/#json |
JSON support was limited to Tedious due to experimental phase. I was curious about the feedback on the implementation. All the logic behind this lays in node-mssql so I added support for additional drivers in 3.3.0. |
Any update on the JSON support from SQL Server 2016? |
In SQL Server GitHub samples you can find example RESP API that has some wrapper around tediuos that leverages FOR JSON: https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/json/todo-app/nodejs-express4-rest-api The biggest missing piece is a function that streams results from sql query into some output stream. In this sample is added wrapper function on top of tedious that gets results from Request and on each 'row' event push part of the received JSON into the output stream. |
Sql Server CTP2 enables developers to format Sql query result set as JSON text (see https://msdn.microsoft.com/en-us/library/dn921882.aspx). We just need to add FOR JSON clause after any query, e.g.:
Are there some plans to add support for this clause in tedious? In this case we don't need to read rows/cells from result - we can just take entire JSON result object.
Some implementation details:
I have tried to execute FOR JSON query with tedious and it works fine; however, I need to concatenate all chunks as a single text in on-row event handler.
It is not a big problem; however, it would be nice to have built-in function/event handler that returns all concatenated chunks as a single JSON object. Maybe to have new event (e.g. on("json", function(json) { ... } ) ) where event handler function will have concatenated chunks as a valid JSON object.
Since it already works fine it seems to me that this concatenation of results could be just a little enhancement that adds a full support.
The text was updated successfully, but these errors were encountered: