SQL Code Formatting

jason.fonseca posted 5 years ago in General
Whenever I save mysql views I have really long select statements.

When I sql format them in heidi, it keeps each of the select section of the statements on the same line.

Can you update the SQL Formatting code to put each select item on a new line?

So for example

SELECT `p`.`pub_memid` AS `pub_memid`,`a`.`audit_inexcess` AS `audit_inexcess`,`a`.`auditid` AS `auditid`,`a`.`audit_period` AS `audit_period`,

changes to

`p`.`pub_memid` AS `pub_memid`,
`a`.`audit_inexcess` AS `audit_inexcess`,
`a`.`auditid` AS `auditid`,
`a`.`audit_period` AS `audit_period`,

ansgar posted 5 years ago
VIEW code is preserved by HeidiSQL in newer builds, to avoid this long one-liner. I also had this ugly problem on all VIEWs, so I put some effort into HeidiSQL to preserve the original code, by loading the .frm file from the servers data directory. I guess you report about that problem as you did not yet update your HeidiSQL, so please just update to the latest build and you're done.
alesvaupotic posted 3 years ago

this functionality seems to be broken on recent builds with MariaDB 10?

A single regex replace of ",`" with ",\n`" in Ctrl-F8 would save me a ton of clicks and nerves ...smileMaybe as a preferences option or additional formatting on second Ctrl-F8 press? Ctrl-F8 would so become a two-step formatter, first as it works now, second with line breaks on fields.

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