NAME

SQL::Tidy -- tidy up SQL statements.

SYNOPSYS

use SQL::Tidy;
my $tidy = SQL::Tidy->new;
print $tidy->tidy("select xyz from abc");

DESCRIPTION

SQL::Tidy will (hopefully) make your SQL statement look prettier.

METHODS

new

Constructor. It can take a bunch of options (see OPTIONS below).

tidy

Takes an SQL statement (a string) and returns a tidied up version of the same.

add_keywords(qw(keyword1 keyword2))

Add keywords to those already in the instance.

OPTIONS

The options can be either passed to the constructor or be changed later as method calls on the tidy object:

# One way
$tidy = SQL::Tidy->new(width => 75);

# Another way
$tidy->width(75);

indent

Specifies the indent string. The default is two spaces, ' '.

keywords

An array reference to override the default list of keywords.

margin

Start each new line with this string. The default it an empty string.

width

Page width. The default is 75 characters.

BUGS

Completeness

I cannot vouch for the completeness of the keywords. Hopefully, as this module matures, the list of test cases will grow.

Unicode

I have not tested with UTF-8.

LICENSE

This module is licensed under the terms of the Artistic License that covers Perl.

SEE ALSO

SQL::Tokenizer

AUTHOR

Dmitri Tikhonov <dtikhonov@yahoo.com>