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
| Natural
and condition =
| Condition of string * predicate
| Condition of predicand * predicate
| And of condition * condition
| Or of condition * condition
| Not of condition
and predicand =
| Ref of string
and predicate =
| Comparison of operator * string
| Between of string * string
| NotBetween of string * string
| Comparison of operator * predicand
| Between of predicand * predicand
| NotBetween of predicand * predicand
| In of string list
| NotIn of string list
| Like of string

View File

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

View File

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