blob: 7532eaabc303715ac6a57b15ab1919c51b2f3bc3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
let default_batch = 50
type cursor_batch = {
cursor_id : string;
rows : Tuple.materialized list;
has_more : bool;
}
type exec_result = Batch of cursor_batch | Closed of Management.Multigroup.multigroup
module Make (Storage : Management.Physical.S) = struct
module DrlExec = Drl.Executor.Make (Storage)
module Alg = Algebra.Make (Storage)
type error =
| ParseError of string
| QueryError of DrlExec.error
| CursorError of string
let sexp_of_error e =
let open Sexplib.Sexp in
match e with
| ParseError s -> List [ Atom "parse-error"; Atom s ]
| QueryError e -> DrlExec.sexp_of_error e
| CursorError s -> List [ Atom "cursor-error"; Atom s ]
let ( let* ) = Result.bind
let execute (_storage : Storage.t) (db : Management.Multigroup.multigroup)
(stmt : Ast.statement) : (exec_result, error) result =
ignore default_batch;
match stmt with
| Ast.Begin _ ->
Error (CursorError "cursors not yet implemented")
| Ast.Fetch _ ->
Error (CursorError "cursors not yet implemented")
| Ast.Close _ ->
let* () = Ok () in
Ok (Closed db)
end
module Memory = Make (Management.Physical.Memory)
|