Parse UNION or EXCEPT operation
(tokens: &[Token])
| 892 | |
| 893 | /// Parse UNION or EXCEPT operation |
| 894 | fn parse_union_except_op(tokens: &[Token]) -> IResult<&[Token], (SetOperationType, Query)> { |
| 895 | alt(( |
| 896 | // UNION [ALL] |
| 897 | map( |
| 898 | tuple(( |
| 899 | expect_token(Token::Union), |
| 900 | opt(expect_token(Token::All)), |
| 901 | parse_intersect, |
| 902 | )), |
| 903 | |(_, all, right)| { |
| 904 | let op = if all.is_some() { |
| 905 | SetOperationType::UnionAll |
| 906 | } else { |
| 907 | SetOperationType::Union |
| 908 | }; |
| 909 | (op, right) |
| 910 | }, |
| 911 | ), |
| 912 | // EXCEPT [ALL] |
| 913 | map( |
| 914 | tuple(( |
| 915 | expect_token(Token::Except), |
| 916 | opt(expect_token(Token::All)), |
| 917 | parse_intersect, |
| 918 | )), |
| 919 | |(_, all, right)| { |
| 920 | let op = if all.is_some() { |
| 921 | SetOperationType::ExceptAll |
| 922 | } else { |
| 923 | SetOperationType::Except |
| 924 | }; |
| 925 | (op, right) |
| 926 | }, |
| 927 | ), |
| 928 | ))(tokens) |
| 929 | } |
| 930 | |
| 931 | /// Parse INTERSECT operation |
| 932 | fn parse_intersect_op(tokens: &[Token]) -> IResult<&[Token], (SetOperationType, Query)> { |
no test coverage detected