parse a join b without inner
This commit is contained in:
parent
9461a11c97
commit
adfeac8d16
|
@ -518,7 +518,8 @@ tref
|
||||||
> <*> nonJoinTref
|
> <*> nonJoinTref
|
||||||
> <*> optionMaybe (joinCondition nat))
|
> <*> optionMaybe (joinCondition nat))
|
||||||
> >>= optionSuffix joinTrefSuffix
|
> >>= optionSuffix joinTrefSuffix
|
||||||
> joinType = choice
|
> joinType =
|
||||||
|
> choice [choice
|
||||||
> [JCross <$ try (keyword_ "cross")
|
> [JCross <$ try (keyword_ "cross")
|
||||||
> ,JInner <$ try (keyword_ "inner")
|
> ,JInner <$ try (keyword_ "inner")
|
||||||
> ,choice [JLeft <$ try (keyword_ "left")
|
> ,choice [JLeft <$ try (keyword_ "left")
|
||||||
|
@ -526,6 +527,7 @@ tref
|
||||||
> ,JFull <$ try (keyword_ "full")]
|
> ,JFull <$ try (keyword_ "full")]
|
||||||
> <* optional (try $ keyword_ "outer")]
|
> <* optional (try $ keyword_ "outer")]
|
||||||
> <* keyword "join"
|
> <* keyword "join"
|
||||||
|
> ,JInner <$ keyword_ "join"]
|
||||||
> joinCondition nat =
|
> joinCondition nat =
|
||||||
> choice [guard nat >> return JoinNatural
|
> choice [guard nat >> return JoinNatural
|
||||||
> ,try (keyword_ "on") >>
|
> ,try (keyword_ "on") >>
|
||||||
|
|
|
@ -47,9 +47,8 @@ queries section
|
||||||
> ,"SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num AND t2.value = 'xxx';"
|
> ,"SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num AND t2.value = 'xxx';"
|
||||||
> ,"SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num WHERE t2.value = 'xxx';"
|
> ,"SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num WHERE t2.value = 'xxx';"
|
||||||
|
|
||||||
> --,"SELECT * FROM some_very_long_table_name s JOIN another_fairly_long_name a ON s.id = a.num;"
|
> ,"SELECT * FROM some_very_long_table_name s JOIN another_fairly_long_name a ON s.id = a.num;"
|
||||||
> -- issue with join keyword on its own?
|
> ,"SELECT * FROM people AS mother JOIN people AS child ON mother.id = child.mother_id;"
|
||||||
> --,"SELECT * FROM people AS mother JOIN people AS child ON mother.id = child.mother_id;"
|
|
||||||
> ,"SELECT * FROM my_table AS a CROSS JOIN my_table AS b;"
|
> ,"SELECT * FROM my_table AS a CROSS JOIN my_table AS b;"
|
||||||
> ,"SELECT * FROM (my_table AS a CROSS JOIN my_table) AS b;"
|
> ,"SELECT * FROM (my_table AS a CROSS JOIN my_table) AS b;"
|
||||||
> --,"SELECT * FROM getfoo(1) AS t1;" -- function tableref
|
> --,"SELECT * FROM getfoo(1) AS t1;" -- function tableref
|
||||||
|
|
|
@ -20,6 +20,10 @@ expression
|
||||||
> ,ms [TRJoin (TRSimple "t") JInner (TRSimple "u")
|
> ,ms [TRJoin (TRSimple "t") JInner (TRSimple "u")
|
||||||
> (Just $ JoinOn $ Iden "expr")])
|
> (Just $ JoinOn $ Iden "expr")])
|
||||||
|
|
||||||
|
> ,("select a from t join u on expr"
|
||||||
|
> ,ms [TRJoin (TRSimple "t") JInner (TRSimple "u")
|
||||||
|
> (Just $ JoinOn $ Iden "expr")])
|
||||||
|
|
||||||
> ,("select a from t left join u on expr"
|
> ,("select a from t left join u on expr"
|
||||||
> ,ms [TRJoin (TRSimple "t") JLeft (TRSimple "u")
|
> ,ms [TRJoin (TRSimple "t") JLeft (TRSimple "u")
|
||||||
> (Just $ JoinOn $ Iden "expr")])
|
> (Just $ JoinOn $ Iden "expr")])
|
||||||
|
|
Loading…
Reference in a new issue