1
Fork 0

add support for extended aggregate syntax

This commit is contained in:
Jake Wheat 2013-12-13 23:18:30 +02:00
parent 5e56a4b560
commit 81e7aa818b
4 changed files with 41 additions and 16 deletions
Language/SQL/SimpleSQL

View file

@ -30,6 +30,15 @@ back into SQL source text. It attempts to format the output nicely.
> scalarExpr (App f es) = text f <> parens (commaSep (map scalarExpr es))
> scalarExpr (AggregateApp f d es od) =
> text f
> <> parens ((case d of
> Just Distinct -> text "distinct"
> Just All -> text "all"
> Nothing -> empty)
> <+> commaSep (map scalarExpr es)
> <+> orderBy od)
> scalarExpr (SpecialOp nm [a,b,c]) | nm `elem` ["between", "not between"] =
> sep [scalarExpr a
> ,text nm <+> scalarExpr b