SQL Code Formatting

[expired user #5084]'s profile image [expired user #5084] posted 12 years ago in General Permalink
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

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

ansgar's profile image ansgar posted 12 years ago Permalink
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's profile image alesvaupotic posted 10 years ago Permalink
Ansgar,

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.