distal-attribute
distal-attribute
distal-attribute
distal-attribute

SQL Code Formatting

User, date Message
Written by jason.fonsecaMoney, Euro
2 years ago
Category: General
7 posts since Fri, 06 Aug 10
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`,

Written by ansgar
2 years ago
4967 posts since Fri, 07 Apr 06
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.
Written by alesvaupotic
1 week ago
2 posts since Sun, 06 Jul 14
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.