File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,12 @@ let connect () =
4040
4141let stream res =
4242 let module F = struct exception E of M. error end in
43- let next _ =
43+ let rec next () =
4444 match M.Res. fetch (module M.Row. Map ) res with
45- | Ok (Some _ as row ) -> row
46- | Ok None -> None
45+ | Ok (Some x ) -> Seq. Cons (x, next)
46+ | Ok None -> Seq. Nil
4747 | Error e -> raise (F. E e) in
48- try Ok (Stream. from next)
49- with F. E e -> Error e
48+ next
5049
5150let main () =
5251 let mariadb = connect () |> or_die " connect" in
@@ -56,8 +55,8 @@ let main () =
5655 let res = M.Stmt. execute stmt [| `String " r%" |] |> or_die " exec" in
5756 assert (M.Res. affected_rows res = M.Res. num_rows res);
5857 printf " #rows: %d\n %!" (M.Res. num_rows res);
59- let s = stream res |> or_die " stream " in
60- Stream . iter print_row s;
58+ let s = stream res in
59+ Seq . iter print_row s;
6160 M.Stmt. close stmt |> or_die " stmt close" ;
6261 M. close mariadb;
6362 M. library_end () ;
You can’t perform that action at this time.
0 commit comments