hankinsoft / SQLPro

SQLPro bug & features tracking.
104 stars 27 forks source link

Option for how to resize columns on execution of queries #966

Closed sinklair closed 3 months ago

sinklair commented 6 months ago

Is your feature request related to a problem? Please describe. When executing a query, the columns are sometimes autosized to fill the width of the results window and sometimes sized to fit the data in each column (I think this is dependent on the number of rows returned). I, personally, prefer the option where columns are sized to fit the data rather than fill the width of the results area, especially when a query returns only a few columns.

Describe the solution you'd like Provide an app setting to allow the user to choose which option they prefer, regardless of the number of results.

Describe alternatives you've considered Another solution (or even a nice additional feature) would be to modify the right-click menu to break "Autosize Columns" into two options - Size to fit and Autosize to window

Additional context Screenshot

Environment (please complete the following information):

hankinsoft commented 3 months ago

Adding the extended menu items for the next build. Thinking of going with:

'Autosize columns' -> 'Size uniform' 'Autosize columns' -> 'Size to data'

The first option will attempt to resize the columns to be the same width. Possibly within the window width if possible. The second option will try and size the columns to the data within them.

hankinsoft commented 3 months ago

https://sqlprostudio.s3.us-east-1.amazonaws.com/studio/SQLProStudio.2024.33.app.zip adds the right click option which contains two different sizing options. If you get the chance, please give it a try and let me know if it works as you would expect.

sinklair commented 3 months ago

The column sizing seems for "To Content" seems to be sizing to the first row only. Not sure is you can improve on that it's causing truncation on following rows that have more text. Screenshot by Dropbox Capture

I'm wondering now if there should be a third option for the old behavior that sized to fit in the window.

hankinsoft commented 3 months ago

Thanks for that, I was able to reproduce with a bit more testing. Could you try: https://sqlprostudio.s3.us-east-1.amazonaws.com/studio/SQLProStudio.2024.34.app.zip

I think that should sort it out.

sinklair commented 3 months ago

Seems now there is a crash on queries with a large number of columns. This statement crashes the app:

SELECT
    'This',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text',
    'That',
    'This is a long piece of text'
hankinsoft commented 3 months ago

Oh shoot, that was a dumb mistake on my part. A fixed build is here:

https://sqlprostudio.s3.us-east-1.amazonaws.com/studio/SQLProStudio.2024.35.app.zip

FYI, tables with more than 20 columns will be uniform regardless of the formatting choice. This is to help prevent performance issues. I could potentially increase this a bit if its causing you issues, but I think most tables will be less than 20 columns.

sinklair commented 3 months ago

Sounds like a reasonable restriction.

This version works for me. Thanks