addingt predicands

This commit is contained in:
Simon Petit 2024-12-09 21:34:23 +01:00
parent 0c11800ff7
commit 4a42d3496f
3 changed files with 28 additions and 25 deletions

View File

@ -16,14 +16,16 @@ and join_type =
| Union | Union
| Natural | Natural
and condition = and condition =
| Condition of string * predicate | Condition of predicand * predicate
| And of condition * condition | And of condition * condition
| Or of condition * condition | Or of condition * condition
| Not of condition | Not of condition
and predicand =
| Ref of string
and predicate = and predicate =
| Comparison of operator * string | Comparison of operator * predicand
| Between of string * string | Between of predicand * predicand
| NotBetween of string * string | NotBetween of predicand * predicand
| In of string list | In of string list
| NotIn of string list | NotIn of string list
| Like of string | Like of string

View File

@ -110,7 +110,8 @@ parenthesized_value_expression:
| LEFT_PAREN value_expression RIGHT_PAREN { $2 } | LEFT_PAREN value_expression RIGHT_PAREN { $2 }
nonparenthesized_value_expression_primary: nonparenthesized_value_expression_primary:
| column_reference { $1 } | column_reference { Ref($1) }
(*| set_function_specification { Ref("function") } *)
(***************************) (***************************)
@ -443,8 +444,8 @@ as_clause :
predicate : predicate :
| comparison_predicate { $1 } | comparison_predicate { $1 }
| between_predicate { $1 } (* | between_predicate { $1 } *)
| in_predicate { $1 } (* | in_predicate { $1 } *)
(* | like_predicate { $1 }*) (* | like_predicate { $1 }*)
(*****************) (*****************)
@ -536,14 +537,14 @@ search_condition:
(* 10.9 AGGREGATE FUNCTION *) (* 10.9 AGGREGATE FUNCTION *)
aggregate_function: aggregate_function:
| COUNT LEFT_PAREN ASTERISK RIGHT_PAREN { Asterisk } | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN { }
| COUNT LEFT_PAREN ASTERISK RIGHT_PAREN filter_clause { Asterisk } | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN filter_clause { }
| general_set_function { $1 } | general_set_function { }
| general_set_function filter_clause { $1 } | general_set_function filter_clause { }
general_set_function: general_set_function:
| set_function_type LEFT_PAREN value_expression RIGHT_PAREN { $3 } | set_function_type LEFT_PAREN value_expression RIGHT_PAREN { }
| set_function_type LEFT_PAREN set_quantifier value_expression RIGHT_PAREN { $4 } | set_function_type LEFT_PAREN set_quantifier value_expression RIGHT_PAREN { }
set_function_type: set_function_type:
| computationnal_operation {} | computationnal_operation {}

View File

@ -30,8 +30,8 @@ let test_default_join () =
Table("t2"), Table("t2"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "b") Comparison(Equals, Ref("b"))
) )
) )
)], )],
@ -50,8 +50,8 @@ let test_left_join () =
Table("t2"), Table("t2"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "b") Comparison(Equals, Ref("b"))
) )
) )
)], )],
@ -70,8 +70,8 @@ let test_right_join () =
Table("t2"), Table("t2"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "b") Comparison(Equals, Ref("b"))
) )
) )
)], )],
@ -90,8 +90,8 @@ let test_inner_join () =
Table("t2"), Table("t2"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "b") Comparison(Equals, Ref("b"))
) )
) )
)], )],
@ -156,8 +156,8 @@ let test_join_join () =
Table("t2"), Table("t2"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "b") Comparison(Equals, Ref("b"))
) )
) )
), ),
@ -165,8 +165,8 @@ let test_join_join () =
Table("t3"), Table("t3"),
Some( Some(
Condition( Condition(
"a", Ref("a"),
Comparison(Equals, "c") Comparison(Equals, Ref("c"))
) )
) )
) )