diff options
Diffstat (limited to 'bin/mainlite.ml')
-rw-r--r-- | bin/mainlite.ml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/mainlite.ml b/bin/mainlite.ml index 42b0009..f288891 100644 --- a/bin/mainlite.ml +++ b/bin/mainlite.ml @@ -31,6 +31,19 @@ let () = let db_uri = Uri.make ~scheme:"sqlite3" ~path:"/home/y/code/ocaml/combattant/bulkdata/blog.db" () in + (* Create connection pool with initialization function *) + (* let connect_pool ~sw ~stdenv uri = + Caqti_eio_unix.connect_pool + ~sw + ~stdenv + ~post_connect:(fun conn -> + (* Initialize each connection with SQLite performance pragmas *) + match Query.init_connection conn with + | Ok () -> Ok () + | Error err -> Error err) + uri + in + match connect_pool ~sw ~stdenv:(env :> Caqti_eio.stdenv) db_uri with *) match Caqti_eio_unix.connect_pool ~sw ~stdenv:(env :> Caqti_eio.stdenv) db_uri with | Ok pool -> let server = Server.create ~config (request_handler ~db_pool:pool) in |