intersystems-community / sqltools-intersystems-driver

InterSystems support for SQL in the SQLTools extension to Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=intersystems-community.sqltools-intersystems-driver
MIT License
10 stars 9 forks source link

Capture and prettify <STORE> error when result set is too big #4

Open bdeboe opened 3 years ago

bdeboe commented 3 years ago

I ran into a error when executing a SELECT from a somewhat bigger table. While the regular table browse function uses some form of paging to limit the result set to be returned, it's probably not appropriate to fiddle with user-supplied queries in the same way, even if it's a blunt a SELECT , so let's maybe detect if the returned error is a one as in the snippet below and return something nicer such as "Query result set is too big. Please use a TOP clause or change the statement to retrieve fewer rows"

ERROR #5002: ObjectScript error: <STORE>^%Api.Atelier.v1.1 [^%Api.Atelier.v1.1:USER]

https://github.com/intersystems-community/sqltools-intersystems-driver/blob/bf8d99c351a2c4fee5f612ce819854b3afca36f7/src/ls/irisdb.ts#L141

bdeboe commented 1 year ago

A change to the server-side API (Atelier API v6) to limit the number of rows to return is on its way to 2023.1, due for preview release in the next month or so. Taking advantage of this on the SQLTools side should significantly lower the risk of running into this error.

CC @isc-bsaviano

isc-bsaviano commented 1 year ago

Atelier API v6 adds support for a new max query parameter that accepts a positive integer and restricts the number of rows returned for each result set to that value. If the value is not a positive integer or the parameter was not passed, all rows will be returned. This extension should expose a setting that controls this parameter for all requests and the default should probably be between 500-1000.