sql-cli icon indicating copy to clipboard operation
sql-cli copied to clipboard

Add support for pagination

Open mvrozanti opened this issue 6 years ago • 3 comments

Hi I love this

I was hoping pagination could be added but I'm not sure how that would work. Maybe select count(*) from table before the actual query? It would make every query slower though. Is this a wanted feature?

Thanks for this tool anyways!

mvrozanti avatar Dec 26 '19 17:12 mvrozanti

Hi Marcelo

Thank you for your comments.

Currently pagination is up to the author of the query to control i.e. by using limit and top clause. Since it is possible to redirect the output of the program to file, modifying the query of the user to add a limit clause can give undesirable results.

hasankhan avatar Dec 27 '19 05:12 hasankhan

Understandable. What if it was an option? I ask this because while it's always desirable to get the full query response when scripting, we don't always (most likely never) want it on interactive mode. The option could even have an optional setting for the row count of each page that default to terminal height or something. I'm gonna fiddle a bit with this

mvrozanti avatar Dec 27 '19 15:12 mvrozanti

Sure, that seems reasonable. Feel free to send a pull request if you'd like to contribute this feature.

hasankhan avatar Dec 27 '19 15:12 hasankhan