SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[12.1.279 Pro] - Text Length for In-line Parentheses

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[12.1.279 Pro] - Text Length for In-line Parentheses
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2099

Post [12.1.279 Pro] - Text Length for In-line Parentheses Reply with quote
There is something fishy with the settings named in the title. I recall it working properly in the past but now it glitches.
I have the formatting setting Text Length for In-line Parentheses set to 180 and the following code in the editor:

Code:

SELECT u.*
        ,(SELECT ui.`name`
        FROM `user_include` AS ui
        WHERE 1 = 1
        AND ui.`login` = u.`login`)  AS y
        ,(CASE
              WHEN a = 1 THEN 1
              ELSE 0
          END)   AS x
    FROM `cte_user`                            AS u
    WHERE 1 = 1
        AND EXISTS (SELECT 1
            FROM `user_include` AS ui
            WHERE 1 = 1
            AND ui.`login` = u.`login`)


According to my formatting rule this should end up like this:
Code:

SELECT u.*
        ,(SELECT ui.`name` FROM `user_include` AS ui WHERE 1 = 1 AND ui.`login` = u.`login`)  AS y
        ,(CASE WHEN a = 1 THEN 1 ELSE 0 END)   AS x
    FROM `cte_user`                            AS u
    WHERE 1 = 1
        AND EXISTS (SELECT 1 FROM `user_include` AS ui WHERE 1 = 1 AND ui.`login` = u.`login`)


However, it becomes this instead:
Code:

SELECT u.*
        ,(SELECT ui.`name`
              FROM `user_include` AS ui
              WHERE 1 = 1
                  AND ui.`login` = u.`login`)  AS y
        ,(CASE WHEN a = 1 THEN 1 ELSE 0 END)   AS x
    FROM `cte_user`                            AS u
    WHERE 1 = 1
        AND EXISTS (SELECT 1
                         FROM `user_include` AS ui
                         WHERE 1 = 1
                             AND ui.`login` = u.`login`)


The CASE part gets single-lined correctly, but the two subqueries, both being much shorter than 180 characters, are formatted as if they were longer than 180. Even if I include the surplus spaces between the opening and closing brackets in the original code, the subqueries are shorter than 110 characters, yet they aren't formatted to make a single line. At first, I thought that SA breaks the subquery in the SELECT part into multiple lines so that it can align the alias name (it shouldn't) but that does not explain why the subquery in the WHERE part isn't formatted correctly either.
Tue Nov 08, 2022 7:27 pm 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.