Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Formatting

theking's profile image theking posted 1 month ago in Feature discussion Permalink

Long queries are formatted like this:

select
    comma seperated stuff

from many
join joins using(more stuff)


where   0=0
    and p.AKTIV
    and ITEMNR not in("LOGIST")
    and TDYEAR = 2022
    and not(StandardCost2 < PIECEPRICE /*and PIECEPRICE < EXFACTORYPRICE*/)

If I reformat this heidisql collapses all the wheres into one long line. Is there a setting I'm missing?

(Btw it also uppercases all keywords despite the fact that I've switched this off in settings. In my specific DB all the field names are uppercase so I would prefer SQL not shouting at me. but that probably is a neverending discussion)

ansgar's profile image ansgar posted 1 month ago Permalink

If I reformat this heidisql collapses all the wheres into one long line. Is there a setting I'm missing?

No, there is no setting for that reformat feature. Reformatting is just quite incomplete and needs a new implementation.

Are you sure you switched off the auto-uppercasing feature? Or was it uppercased during the reformat?

Description

theking's profile image theking posted 1 month ago Permalink

It was lowercase befor, the setting to use lowercase was on but still keywords were shouting afterwards. Does anyone know what SQL parser is used in heidisql? After a parse tree is build formatting should be simple.

I'd love to to assist in development bugfixing. See my credentials in SO and github. I've been doing DB development for about 20 years. Let me know if interested.

ansgar's profile image ansgar posted 1 month ago Permalink

The reformat feature calls a single function, which you can see here: https://github.com/HeidiSQL/HeidiSQL/blob/d82a8cc8f7053ccf6f0b28a7471643c3da9d1835/source/apphelpers.pas#L1694

Original ticket is from 2007: https://sourceforge.net/p/heidisql/tickets/428/

Please login to leave a reply, or register at first.




Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.