Manual for Pl/Sql Tidy version 1.2
This software allows you to tidy/beautify/format your Pl\Sql
code in a batch file or Dos prompt.
This is a command line tool that gives you the freedom to build
it in your programming environment. You can use it in your favorite
editor easily.
Goto to the installation directory and enter in dos:
psti -h
for the options and help,
In a regular editor, there are user definable tools. Set a
tool to execute psti.
Make sure that the working directory is the same as the installation
directory. Otherwise, it won't work.
E.g. Ultraedit
Command line : psti -io %F
Working directory: d:\psti
Incorrect switches are simply ignored. You are informed about
that.
Incompatible switches are allowed. The switches that come later
will override earlier ones.
There are 3 types of switches:
-with no value (-h,-v)
-with 2 possible value (-rs+,-rs-)
-with many possible values (-i,-o..)
Many switches are already "on" by default. Therefore things may
not work out as you expect.
Take these into account when using switches.
Here is the list:
-in+ -uk+ -c+ -rsaob+ -co+ -ncb+ -rs+ -iaew+ -iacw+ -iac+ -clb+
Switch/option |
Meaning |
-i filename/stdin |
use filename as input file or use standard input as source |
-o filename/stdout |
use filename output file (tidied up) or use standard output as destination |
-io |
filename same input and output file |
-sl lineno |
tidy lines from this lineno on |
-se lineno |
tidy lines up to that lineno |
-t size |
tab is equal to size spaces |
-is size |
indent size in spaces (generally) |
-in[+,-] |
indent lines yes/no |
-il[Level] |
size indent size at Level(specific) |
-uk[+,-] |
uppercase keywords yes/no |
-ck[+,-] |
capital keywords yes/no |
-lk[+,-] | lowercase keywords yes/no |
-ui[+,-] | uppercase identifiers yes/no |
-ci[+,-] | capital identifiers yes/no |
-li[+,-] | lowercase identifiers yes/no |
-clb[+,-] |
column like lists inside brackets |
-c[+,-] |
compactify, remove redundant spaces/keep |
-co[+,-] |
remove spaces around operations (+,- etc/do nothing/) |
-sao[+,-] |
add space around operations/do nothing |
-rsaob[+,-] |
remove spaces after opening brackets/keep |
-iic[+,-] |
indent inside comments/do nothing |
-ncb[+,-] |
don't remove spaces around brackets/do nothing |
-rs[+,-] |
keep the relative identation of a select/do nothing |
-iaew[+,-] |
indent after exception when yes/no |
-iacw[+,-] | indent after case when yes/no |
-iac[+,-] |
indent after cursor yes/no |
-acav[+,-] |
align consecutive assignments (:=)
vertically |
-isc[+,-] |
indent standalone comments |
-x |
does not execute anything, just prints info about the configuration given by command line |
-v |
verbose , same as -x but it will tidy |
-b maxvers |
number of backup versions to keep |
-bdir directory |
set backup directory |
-h |
help |
lists you all possible switches you can use.
shows you the settings.
This is the filename of scripts to tidy.
If the filename is stdin, the program uses the standard input as a
source
E.g. psti -i=h.sql
E.g psti -i stdin
Default value: input filename + ".tdy"
This is the resultant file of the formatting.
If filename is stdout, the program uses the standard output as a
destination.
E.g. psti -i=h.sql -o=h2.sql
E.g psti -i stdin -o stdout
The resultant fiile will not contain lines before line lineno
of the original file.
E.g. psti -i=h.sql -sl 4
The resultant file will not contain lines after line lineno of
the original file.
E.g. psti -i=h.sql -sl 2000
This is a shortcut for -i and -o.
E.g. psti -io=h.sql
E.g. psti -io=h.sql -t 4
Default value: 2 spaces
Probably it is one of the most important switches.
E.g. psti -io=h.sql -is 3
Level refers to how many spaces of indentation precedes a
given line of
code. The code inside a loop is more indented than the code before the
loop.
Statements that make the level of code higher/more indented :
packages, functions, procedures,loops, if , begin, when(optional),
cursor (optional),
The size is in spaces. Use more of this switch, if you want to set more
than 1 level.
E.g. psti -io=h.sql -is 3 -il1 2 -il2 4
E.g. psti -io=h.sql -uk+
Default state:off.
All keywords will be capitalized. (Begin If Varchar2)
E.g. psti -io=h.sql -ck+
E.g. psti -io=h.sql -lk+
E.g. psti -io=h.sql -ui+
Default state:off.
All identifiers will be capitalized. (Terra5:=3;)
E.g. psti -io=h.sql -ci+
E.g. psti -io=h.sql -li+
Default state:on
E.g. psti -io=h.sql -clb+
this:
a := (a + 1
+ 4
+ 5
+ 8);
will become that:
a := (a + 1
+ 4
+ 5
+ 8);
Default state:on.
E.g. psti -io=h.sql -c+
Original |
procedure h is |
Tidied |
procedure h is |
Default state:on.
E.g. psti -io=h.sql -co+
Original |
d:= 5 + 7; |
Tidied |
d:=5+7; |
Default state:on.
E.g. psti -io=h.sql -co- -sao+
Original |
d:=5+7; |
Tidied |
d := 5 + 7; |
Default state:on.
Original |
FOR rec IN ( SELECT
* FROM dual |
Tidied |
FOR rec IN ( SELECT
* FROM dual |
Tidied |
FOR rec IN (SELECT *
FROM dual |
Default state:off.
If it is on, it will indent text inside /*..*/
Default state:on.
Original |
FOR rec IN(SELECT *
FROM dual |
Tidied |
FOR rec IN (SELECT *
FROM dual |
-rs[+,-] keep
the relative identation of a select/do nothing
Default state:on.
Original |
select * |
Tidied |
select * |
Original |
EXCEPTION |
Tidied |
EXCEPTION |
Original |
CASE opinion |
Tidied |
CASE opinion WHEN '9' THEN dbms_output.put_line('Excellent'); WHEN '5' THEN dbms_output.put_line('Poor'); ELSE dbms_output.put_line('cannot decide'); END CASE; |
Default state:on.
Original |
CURSOR b IS |
Tidied |
CURSOR b IS |
Default state:off.
Original |
derival:=0; |
Tidied |
derival:=0;
|
Original psti -io=h.sql -isc- |
begin /*hello Sql*/ low:=4+4 -- end of little block end; |
Tidied psti -io=h.sql -isc+ |
begin /*hello Sql*/ low:=4+4 -- end of little block end; |
Number of old backup versions to keep +1 (including the
current backup version that is being created)
The original source and its directory path are backed up. Even
old backups are backed
up.
The backup directory can be specified by -bdir switch. Otherwise, it is
the tmp directory.
Some syntax checking is performed. If the check fails, the
code is not tidied.
The following are checked:
-the balance of brackets ()
-runaway/unclosed '
-runaway/unclosed "
-blocks are closed properly (missing end if,end loop, end package
detection)
If the executable runs without error, it returns error code 0.
Otherwise, it returns 2.-Syntax checking. If it fails, the code is not formatted.
-The formatter checks itself. So it does not produce bad code easily.
If self-check fails, it displays the message : Integrity error and the
code is not touched.
-It backs up the original source in the temp directory. (designated by
tmp enviroment variable). By default, 40 versions are backed up. It can
be changed by -b flag.
-Unless you specify -io, the output file is the original filename plus
.tdy. So the original one is not overwritten.
The software can handle/format a code up to a size that is
maximum of 1/3
of the available memory.
(If you have 500 Mbyte memory, it can handle 166Mbyte code). This is an
approximation.
Pl/Sql Tidy
Idea/programmed by Marton Papp ((C)2003-2008 )
End User License Agreement (EULA)
THIS IS FREEWARE AND IS TO BE DISTRIBUTED AS THAT ONLY
===========================================================
You will agree to these terms in order to continue:
1. If you distribute this software, you are to (a) Distribute it in
it's original condition (b) You will send it with all and only the
files that came with it.
2. You will not alter this file or any of the contained files
3. You will not use this application for any illegal activities
4. You will install this application at your own risk. Any damage done
is the responsibility of the end-user
This software contains ABSOLUTELY NO ADWARE, SPYWARE, VIRUSES or other
harmful applications.