Toad World® Forums

formatter issue


#1

Hi,

I reported an annoying empty line issue in

http://tech.groups.yahoo.com/group/toadbeta/message/47932

Which has been fixed J but I found a new one today, pretty annoying L

Original working code :

SELECT * FROM DUAL MODEL DIMENSION BY (1 x) MEASURES (1 y) (y [2] = 0);

No longer working after CTRL-SHIFT-F :

/* Formatted on 03.06.2013 14:10:20 (QP5 v5.252.13127.32847) */

SELECT *

FROM DUAL

MODEL

DIMENSION BY (1 x)

MEASURES (1 y)

  (y [2] = 0);

Note the empty longer working after format when the “RULES” keyword is missing. And yes, RULES is optional unless you iterate.

If you add the RULES keyword, it works, which is an acceptable workaround

SELECT * FROM DUAL MODEL DIMENSION BY (1 x) MEASURES (1 y) RULES (y [2] = 0);

One formatted :

SELECT *

FROM DUAL

MODEL

DIMENSION BY (1 x)

MEASURES (1 y)

RULES

  (y [2] = 0);

Considering there must be about 2-3 developers world-wide but me using MODEL, I suppose it is not high prio J

Cheers

Laurent


#2

And while I am on the topic, the formatter of measures is ugly, it should also process long lines

/* unformatted */

SELECT * FROM DUAL MODEL DIMENSION BY (1 my_very_long_column_name_1a, 2 my_very_long_column_name_2a, 3 my_very_long_column_name_3a, 4 my_very_long_column_name_4a, 5 my_very_long_column_name_5a, 6 my_very_long_column_name_6a, 7 my_very_long_column_name_7a, 8 my_very_long_column_name_8a, 9 my_very_long_column_name_9a, 10 my_very_long_column_name_10a, 11 my_very_long_column_name_11a, 12 my_very_long_column_name_12a) MEASURES ( 1 my_very_long_column_name_1b, 2 my_very_long_column_name_2b, 3 my_very_long_column_name_3b, 4 my_very_long_column_name_4b, 5 my_very_long_column_name_5b, 6 my_very_long_column_name_6b, 7 my_very_long_column_name_7b, 8 my_very_long_column_name_8b, 9 my_very_long_column_name_9b, 10 my_very_long_column_name_10b, 11 my_very_long_column_name_11b, 12 my_very_long_column_name_12b) RULES ();

Does not format at all!

And if add some rules,

SELECT * FROM DUAL MODEL DIMENSION BY (1 my_very_long_column_name_1a, 2 my_very_long_column_name_2a, 3 my_very_long_column_name_3a, 4 my_very_long_column_name_4a, 5 my_very_long_column_name_5a, 6 my_very_long_column_name_6a, 7 my_very_long_column_name_7a, 8 my_very_long_column_name_8a, 9 my_very_long_column_name_9a, 10 my_very_long_column_name_10a, 11 my_very_long_column_name_11a, 12 my_very_long_column_name_12a) MEASURES ( 1 my_very_long_column_name_1b, 2 my_very_long_column_name_2b, 3 my_very_long_column_name_3b, 4 my_very_long_column_name_4b, 5 my_very_long_column_name_5b, 6 my_very_long_column_name_6b, 7 my_very_long_column_name_7b, 8 my_very_long_column_name_8b, 9 my_very_long_column_name_9b, 10 my_very_long_column_name_10b, 11 my_very_long_column_name_11b, 12 my_very_long_column_name_12b) RULES (my_very_long_column_name_1b[1,2,3,4,5,6,7,8,9,10,11,12]=0);

then it formats only a little bit …

/* Formatted on 03.06.2013 15:02:47 (QP5 v5.252.13127.32847) */

SELECT *

FROM DUAL

MODEL

DIMENSION BY (1 my_very_long_column_name_1a, 2 my_very_long_column_name_2a, 3 my_very_long_column_name_3a,


#3

For the blank line issue I already wrote in www.toadworld.com/.../39518.aspx that I’m not only working on this simple case for also on more complex cases.

About the 2nd issue the checker doesn’t accept RULES () - empty rule clause - as this is not documented syntax. But if Oracle really accepts it (please confirm it does) then we’ll support it as well.

model_rules_clause.gif

The “formatting a little bit” actually shows that the lists themselves are not formatted. That has now been fixed.

Thanks for bringing up all the above. If you would happen to have more complex model clauses then feel free to send them to me so that I can improve formatting.

Thanks,

Andre


#4

My team says that RULES () is valid although undocumented. I fixed the formatter to accept that as well.


#5

Hi André,

Sorry, I did not find the post as we moved away from yahoo groupd

As the 12c doc is now out, I figured out you already implemented 12c syntax, well done :slight_smile:

/* Formatted on 26/06/2013 09:56:56 (QP5 v5.252.13127.32847) */

SELECT ename, dname

FROM emp e,

LATERAL (SELECT *

FROM dept d

WHERE e.deptno = d.deptno);

Thanks

Laurent


#6

Thank you. Yes we did about full 12c beta, and now that 12c is GA we’ll check what we have and catch up missing things asap. Should be done within weeks unless Oracle changed half of the grammar …


#7

Laurent,

The above MODEL issues have been addressed, I worked with a bunch of way more complex model statements as well. You should see the changes whenever your Toad contains a QP5.dll file with version 5.254 or higher.

Thanks for reporting,

Andre


#8

I just noticed the “colouring” of patterns keyword is not implemented (match_recognize, one row per match, pattern and others)


#9

It turns out that 12 GA has not that many changes with respect to beta. The better…

Laurent may I kindly suggest to start new issues in new topics - it tends to get confusing otherwise.

Thanks,

Andre