SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[SA 9.1.276 Pro] - Formatting anomaly in MySQL

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[SA 9.1.276 Pro] - Formatting anomaly in MySQL
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 1400

Post [SA 9.1.276 Pro] - Formatting anomaly in MySQL Reply with quote
I've ran into a funny bug regarding code formatting in MySQL, where the formatted code gets formatted and duplicated without formatting at the same time. It only affects syntactically weird (and incorrect) code (or, at least, it had so far) but one of the most useful "side-effects" of code formatting is that it tends to make malformed code stick out as a sore thumb. The problem is the following:
Given is the code fragment below:
#1
Code:

SELECT 1 AS `a`;


With my current formatting rules this formats to the nice and clean
#2
Code:

-- /*  Formatted to MySQL default at 2017-05-25 16:03:18*/

SELECT
    1 AS `a`;


Now if I accidentally omit the second grave accent and try to format this:
#3
Code:

SELECT 1 AS `a;

it does not really matter, the result will be the same as #2.

If I really make a mess and omit the first one:
#4
Code:

SELECT 1 AS a`;

the code is no longer correct but that will be my slightest problem, because formatting that nasty little imp will turn into:
#5
Code:

-- /*  Formatted to MySQL default at 2017-05-25 16:03:47*/

SELECT
    1     AS
SELECT 1  AS a`;

which causes a rather nasty confusion in cases the not-so-mischievousbrat is hiding in a larger piece of otherwise valid code.
Thu May 25, 2017 10:09 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6509

Post Reply with quote
We may have a "fix" for the code duplication in 9.2. The team looked into this issue and they think it's very easy to fix.
Tue May 30, 2017 9:08 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 1400

Post Reply with quote
That's good news, thank you very much. Not that it happens often but the first time I ran into it was pretty devastating.

UPDATE: Confirmed as fixed in [9.2.346 Pro].
Tue May 30, 2017 11:17 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.