Hi Gilles,
DbVisualizer 6.5 contains an upgraded formatter that is far more configurable that the older version. See Tool Properties, SQL Formatting in the General tab. Among other things, you can enable Alignment on Main Keywords.
Best Regards,
Hans
a
anonymous
said
about 16 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: SQL formatter
I'm already using DbVisualizer 6.5 :)
I know you can align statements, but left-aligned only.
I've been using http://www.sqlinform.com/ for some time, and i've noticed the statement from Roger on the front page ;)
But i don't see as much configuration options in DbVis as in the applet on sqlinform :(, i really miss many of them. And for me it would be easier to have these options integrated into Dbvis than to copy paste each of my sql statements on the applet and back into the editor...
Gilles
Edited by: Gilles Philippart on 31 oct. 2008 09:14
Changed right align to left aligned
a
anonymous
said
about 16 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: SQL formatter
Hi,
especially when you enable "Line Breaks -> Before Comma" the comma lines have no indention, but two spaces, even if you indent by tabs and select a differen tab width (e.g. 8).
select u.ID
,u.NAME
,u.PASSWD
,u.FIRSTNAME
,u.LASTNAME
,u.STREET
,u.EMAIL
from USER_ACCOUNT u ;
:-(
Carsten
Product: DbVisualizer Personal 6.5
Build: #1339 (2008/10/23 11:47)
Java VM: Java HotSpot(TM) Client VM
Java Version: 1.5.0_16
Java Vendor: Sun Microsystems Inc.
OS Name: Windows XP
OS Arch: x86
OS Version: 5.1
Hans Bergsten
said
about 16 years ago
[This reply is migrated from our old forums.]
Re: SQL formatter
Hi Gilles,
Please provide a list of the SQLinForm options you would like to see in DbVisualizer, and we'll try to enable them. Be aware, though, that the SQLinForm applet includes some features that the developer considers "not ready for prime time", so we may not be able to enable all of them.
Kind Regards,
Hans
Hans Bergsten
said
about 16 years ago
[This reply is migrated from our old forums.]
Re: SQL formatter
Hi Carsten,
I agree that this looks a bit odd. I will discuss this with the SQLinForm developer to see if it is a bug or the expected behavior.
Kind Regards,
Hans
Hans Bergsten
said
about 16 years ago
[This reply is migrated from our old forums.]
Re: SQL formatter
Hi Carsten,
I've checked with the SQLinForm developer and what you see is partly how it is designed to work. There are two things to be aware of in this example:
1) The formatter indents the column names, ignoring the commas. So
with an indentation size of 4, the column name is indented to start in
column 4. If you have also selected Line Break Before Comma, the
comma will be appear before the column name. This is the intended
behavior.
2) When you select "Use Tab" for the indentation, the indentation size is
currently hardcoded to 4. This will be changed in the next release so
that the indentation size is set to be the same as the Tab Size value
from the Tool Properties.
Until the next release, you may want to use "8 spaces" instead of "Use Tab" to get the indentation level you like.
Best Regards,
Hans
Roger Bjärevall
said
about 16 years ago
[This reply is migrated from our old forums.]
Re: SQL formatter
Hi,
Just to inform you that DbVisualizer 6.5.1 is now available with a fix for this issue.
Best Regards
Roger
a
anonymous
said
almost 16 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: SQL formatter
Hi Roger,
thanks for the changes, but I'm still a bit unhappy with the results. I sometimes wonder if my formatting style is unusual that noone else is complaining about the formatter rules.
Here's what I want:
- Keywords like "select", "from", "and" etc. begin in the first column (so "linebreak before "AND, OR..." does best). This means, that "where" and "and, or..." are on the same column.
- Column names should be indented, and start with a comma for readability
- Tabs after keywords should remain (e.g. "and<tab>col1='x'") or inserted automatically
- Statementdelimiter ";" should be on a new line
With 6.5.2 I get the following results - one can see, that with "linebreak before AND, OR" the row is indented (still with 4 spaces even though Tabsize is 8) and the columns are also not indented correctly (6 spaces).
My settings are:
- Tabsize 8
- Statement delimiter ";"
- Line break before comma
- Line break before "AND, OR"
- Line break for "CASE" keywords
- Line break for "JOIN" statements
- Remove extra whitespace
- One space around operators
- One space inside parenthesis
- Keep space around comma unchanged
select0 as VIEW_ID
,t.FDN as net_id
fromtransfer_objects_persist t
,nokia_hwdata_obj o
where o.view_id(+) = 0
and o.net_id(+) = t.FDN
and t.PARA_NAME = '@CoRAN_ID'
/* Alle Objekte haben das! */
and NokiaHWData.affectedNE( t.FDN ) = 'RNC'
and o.rowid is null ;
What I want to achive is the following (with tab size 8!):
select0 as VIEW_ID
,t.FDN as net_id
fromtransfer_objects_persist t
,nokia_hwdata_obj o
whereo.view_id(+) = 0
ando.net_id(+) = t.FDN
andt.PARA_NAME = '@CoRAN_ID'
/* Alle Objekte haben das! */
andNokiaHWData.affectedNE( t.FDN ) = 'RNC'
ando.rowid is null
;
(The "xy(+)" is oracle notation for outer joins)
Regards
Carsten
Edited by: chetzel on 12.01.2009 10:37
Hans Bergsten
said
almost 16 years ago
[This reply is migrated from our old forums.]
Re: SQL formatter
Hi Carsten,
I have looked at how you want the statement to be formatted and agree that the current options do not provide for this exact format.
How to format is probably an area where there are almost as many opinions as there are users. We use the SQLinForm third-party product for formatting in DbVisualizer, and while it doesn't cater to all possible formats, it offers a reasonably large set of options.
We integrate new versions of SQLinForm now and then, so you may want to get in touch with the developer to see if the options you need can be added to the product. If so, they will eventually become part of DbVisualizer as well.
Kind Regards,
Hans
anonymous