1
Fork 0

add support for odbc outer join syntax

This commit is contained in:
Jake Wheat 2016-02-21 23:48:55 +02:00
parent c8d745fd28
commit 83b16edb1f
4 changed files with 19 additions and 12 deletions
Language/SQL/SimpleSQL

View file

@ -1356,7 +1356,11 @@ aliases.
> n <- names
> choice [TRFunction n
> <$> parens (commaSep valueExpr)
> ,pure $ TRSimple n]] <??> aliasSuffix
> ,pure $ TRSimple n]
> -- todo: I think you can only have outer joins inside the oj,
> -- not sure.
> ,TROdbc <$> (symbol "{" *> keyword_ "oj" *> tref <* symbol "}")
> ] <??> aliasSuffix
> aliasSuffix = fromAlias <$$> TRAlias
> joinTrefSuffix t =
> (TRJoin t <$> option False (True <$ keyword_ "natural")

View file

@ -390,6 +390,7 @@ which have been changed to try to improve the layout of the output.
> ,if b then text "natural" else empty
> ,joinText jt <+> tr t1
> ,joinCond jc]
> tr (TROdbc t) = text "{oj" <+> tr t <+> text "}"
> joinText jt =
> sep [case jt of
> JInner -> text "inner"

View file

@ -430,6 +430,8 @@ I'm not sure if this is valid syntax or not.
> | TRFunction [Name] [ValueExpr]
> -- | from lateral t
> | TRLateral TableRef
> -- | ODBC {oj t1 left outer join t2 on expr} syntax
> | TROdbc TableRef
> deriving (Eq,Show,Read,Data,Typeable)
> -- | Represents an alias for a table valued expression, used in with