X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FFormatter.pm;fp=lib%2FSQL%2FAbstract%2FFormatter.pm;h=98566eb588fa0688a9f477a0d154dc8d9f97493f;hb=4a9ad1af65dd94ff2b6f2d8a147e9ba19cf5dab8;hp=42237fabe72ffcb4865340ee10d2d1589c9d090b;hpb=0655a7af8219e8fb04fd77ec6d6f9af95cf42a34;p=scpubgit%2FQ-Branch.git diff --git a/lib/SQL/Abstract/Formatter.pm b/lib/SQL/Abstract/Formatter.pm index 42237fa..98566eb 100644 --- a/lib/SQL/Abstract/Formatter.pm +++ b/lib/SQL/Abstract/Formatter.pm @@ -52,13 +52,14 @@ sub _fold_sql { $line = $indent0.')'; next PART; } - push @res, $line.$nl_pre."\n"; + push @res, $line.$nl_pre."\n" if $line =~ /\S/; if (length($line = $indent.$nl_post.$j) <= $w) { next PART; } my $folded = $self->_fold_sql($indent, $next_indent, @$p); + $folded =~ s/\n\Z//; push @res, $folded.$pre."\n"; - $line = $indent.$nl_post; + $line = $idx == $#parts ? '' : $indent.$nl_post; } } return join '', @res, $line;