SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[7.0.132 beta] Formatting glitch in Toad for MySQL

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[7.0.132 beta] Formatting glitch in Toad for MySQL
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2165

Post [7.0.132 beta] Formatting glitch in Toad for MySQL Reply with quote
Toad for MySQL (and I guess any editor marked for MySQL) suffers the same glitch mentioned in Formatting ":=" in Notepad++, namely, ":=" breaks apart by a space put between ":" and "=".
Wed Jul 02, 2014 5:29 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Thank you. I have logged this issue.
Wed Jul 02, 2014 7:58 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Could you please provide a code sample which does get formatted correctly?
Wed Jul 02, 2014 1:44 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2165

Post Reply with quote
Sure. Here it is. This simple query returns the routine with fourth longest definition.

Code:


SELECT * FROM (
SELECT
   r.ROUTINE_CATALOG
   ,r.ROUTINE_SCHEMA
   ,r.ROUTINE_NAME
   ,r.ROUTINE_TYPE
   ,r.ROUTINE_BODY
   ,LENGTH(r.ROUTINE_DEFINITION)
   ,@rownum:=@rownum+1 AS rownum
FROM
   (
      SELECT
         @rownum:= 0
   )                             AS rn
      ,information_schema.ROUTINES  AS r
WHERE   1 = 1
   
ORDER BY LENGTH(r.ROUTINE_DEFINITION) DESC
) AS sq
WHERE   1 = 1
    AND sq.rownum = 4


Pushing this through the formatting process returns the following:

Code:

SELECT
   *
FROM
   (
      SELECT
         r.ROUTINE_CATALOG
         ,r.ROUTINE_SCHEMA
         ,r.ROUTINE_NAME
         ,r.ROUTINE_TYPE
         ,r.ROUTINE_BODY
         ,LENGTH(r.ROUTINE_DEFINITION)
         ,@rownum : = @rownum+1         AS rownum
      FROM
         (
            SELECT
               @rownum : = 0
         )                             AS rn
            ,information_schema.ROUTINES  AS r
      WHERE   1     = 1
      ORDER BY
         LENGTH(r.ROUTINE_DEFINITION) DESC
   ) AS sq
WHERE   1             = 1
   AND   sq.rownum = 4


which in turn results in syntax error when run. The correct format would be:

Code:

SELECT
   *
FROM
   (
      SELECT
         r.ROUTINE_CATALOG
         ,r.ROUTINE_SCHEMA
         ,r.ROUTINE_NAME
         ,r.ROUTINE_TYPE
         ,r.ROUTINE_BODY
         ,LENGTH(r.ROUTINE_DEFINITION)
         ,@rownum := @rownum + 1         AS rownum
      FROM
         (
            SELECT
               @rownum := 0
         )                             AS rn
            ,information_schema.ROUTINES  AS r
      WHERE   1     = 1
      ORDER BY
         LENGTH(r.ROUTINE_DEFINITION) DESC
   ) AS sq
WHERE   1             = 1
   AND   sq.rownum = 4


where the operand is formatted as ' := ' (there is a space on both sides of ':=' but none between ':' and '=').
Wed Jul 02, 2014 4:28 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Thank you
Wed Jul 02, 2014 4:52 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
Hi. We are unable to reproduce this issue.

Could you please try it with factory-default formatting settings?
Thu Jul 03, 2014 8:14 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2165

Post Reply with quote
I works. I compared the default formatting setting for select to mine and it turned out that they differed here and there:
default wrote:

SELECT
... AS ...,
...
INTO
...,
...
FROM
... AS ...,
...
JOIN ...
ON ...
AND ...
WHERE
... = ...
AND ...
OR ...
GROUP BY
...,
...
HAVING
...,
...
ORDER BY
...,
...
LIMIT ...;


mine wrote:

SELECT
... AS ...
,... = ...
INTO
...
,...
FROM
... AS ...
,...
JOIN
...
ON ... = ...
AND ...
OR ...
WHERE ... = ...
AND ...
OR ...
GROUP BY
...
,...
HAVING
...
,...
ORDER BY
...
,...


Merged the two (removed the '= ...' from the SELECT part) and now it seems fine, thanks for the hint.
Thu Jul 03, 2014 9:22 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.