 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[7.0.132 beta] Formatting glitch in Toad for MySQL |
|
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you. I have logged this issue.
|
|
Wed Jul 02, 2014 7:58 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Could you please provide a code sample which does get formatted correctly?
|
|
Wed Jul 02, 2014 1:44 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Sure. Here it is. This simple query returns the routine with fourth longest definition.
 |
 |
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:
 |
 |
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:
 |
 |
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you
|
|
Wed Jul 02, 2014 4:52 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
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 |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
I works. I compared the default formatting setting for select to mine and it turned out that they differed here and there:
 |
 |
SELECT
... AS ...,
...
INTO
...,
...
FROM
... AS ...,
...
JOIN ...
ON ...
AND ...
WHERE
... = ...
AND ...
OR ...
GROUP BY
...,
...
HAVING
...,
...
ORDER BY
...,
...
LIMIT ...;
|
 |
 |
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 |
|
 |
|
|
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
|
|
|