1
Fork 0

add with expressions, all tpch appear to parse correct, some of the later ones pretty print badly though

This commit is contained in:
Jake Wheat 2013-12-14 00:58:12 +02:00
parent 15c83555ff
commit 931272d1db
5 changed files with 60 additions and 28 deletions
Language/SQL/SimpleSQL

View file

@ -143,6 +143,12 @@ back into SQL source text. It attempts to format the output nicely.
> Corresponding -> text "corresponding"
> Respectively -> empty
> ,queryExpr q2]
> queryExpr (With withs qe) =
> text "with"
> <+> vcat [nest 4
> (vcat $ punctuate comma $ flip map withs $ \(n,q) ->
> text n <+> text "as" <+> parens (queryExpr q))
> ,queryExpr qe]
> selectList :: [(Maybe String, ScalarExpr)] -> Doc
> selectList is = commaSep $ map si is