On Tue, Jul 17, 2001 at 12:29:13PM -0500, Andy Bach wrote:
> Hi Folks,
> 
> I got a request of sorts to pretty print SQLs (ugly print I think but 
> ...) in the format:
>      select
>         biz,
>         baz,
>         boom
>      from
>         ding,
>         dang
>      where
>         zz = yy
>      and
>         pp = zz
>     order by
>         baz
> 
> and I thought; perl, BN, Parse:RecDescent ... FWP!!
> 
> Any hints? Golf?


Every database server has its own SQL dialect so it's hard to make it
generic. I know Sybase and its documentation fairly well, and I would
say it isn't rocket science to parse it with Parse::RecDescent. But
it's going to be quite a lot of work, most of it pretty boring, because
the language isn't that small. 

I disagree that SQL is "ugly" though. I find that SQL can be formatted
much prettier than Perl or C.



Abigail

Reply via email to