adding filter to SELEC

This commit is contained in:
Simon Petit 2024-12-09 20:57:43 +01:00
parent 2e00eb4e86
commit dc1ea6642f

View File

@ -1,6 +1,6 @@
type query = Query of select_stmt type query = Query of select_stmt
and select_stmt = and select_stmt =
| Select of column list * table list | Select of column list * table list * filter option
and column = and column =
| Asterisk | Asterisk
| Column of string | Column of string
@ -27,6 +27,7 @@ and predicate =
| In of string list | In of string list
| NotIn of string list | NotIn of string list
| Like of string | Like of string
| NotLike of string
and operator = and operator =
| Equals | Equals
| NotEquals | NotEquals
@ -35,19 +36,17 @@ and operator =
| LessEquals | LessEquals
| GreaterEquals | GreaterEquals
and filter = and filter =
| Filter of string | Filter of condition
and search_condition = and search_condition =
| Search of string | Search of string
let rec pp_query fmt ast = let rec pp_query fmt ast =
match ast with match ast with
| Query(s) -> Format.fprintf fmt "%s" (pp_select s) | Query(s) -> Format.fprintf fmt "%s" (pp_select s)
and pp_select s = and pp_select s =
match s with match s with
| Select(cols, _) -> pp_columns cols | Select(cols, _, _) -> pp_columns cols
and pp_columns cols = and pp_columns cols =
match cols with match cols with
@ -81,4 +80,3 @@ and pp_join_type j =
| Union -> "union" | Union -> "union"
| Natural -> "natural" | Natural -> "natural"