add support for functions in tablerefs
This commit is contained in:
parent
adfeac8d16
commit
d49b3ddb99
5 changed files with 15 additions and 6 deletions
Language/SQL/SimpleSQL
|
@ -505,6 +505,8 @@ tref
|
|||
> tref = nonJoinTref >>= optionSuffix joinTrefSuffix
|
||||
> nonJoinTref = choice [try (TRQueryExpr <$> parens queryExpr)
|
||||
> ,TRParens <$> parens tref
|
||||
> ,try (TRFunction <$> identifierString
|
||||
> <*> parens (commaSep scalarExpr))
|
||||
> ,TRSimple <$> identifierString]
|
||||
> >>= optionSuffix aliasSuffix
|
||||
> aliasSuffix j =
|
||||
|
|
|
@ -182,6 +182,8 @@
|
|||
> ,nest 5 $ vcat $ punctuate comma $ map tr ts]
|
||||
> where
|
||||
> tr (TRSimple t) = text t
|
||||
> tr (TRFunction f as) =
|
||||
> text f <> parens (commaSep $ map scalarExpr as)
|
||||
> tr (TRAlias t a cs) =
|
||||
> sep [tr t
|
||||
> ,text "as" <+> text a
|
||||
|
|
|
@ -195,6 +195,8 @@ I'm not sure if this is valid syntax or not.
|
|||
> | TRAlias TableRef String (Maybe [String])
|
||||
> -- | from (query expr)
|
||||
> | TRQueryExpr QueryExpr
|
||||
> -- | from function(args)
|
||||
> | TRFunction String [ScalarExpr]
|
||||
> deriving (Eq,Show,Read)
|
||||
|
||||
TODO: add function table ref
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue