You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Mariadb as backend so I thought I'd use ocaml-mariadb instead of ocaml-mysql as transport. The following code almost works (in the sense that it nearly builds, haven't actually run it yet) but I have a few questions.
include Ppx_mysql_runtime.Make_context({
module IO = Lwt;
module Prepared = {
type dbh = Mariadb_with_lwt.t;
type stmt = Mariadb_with_lwt.Stmt.t;
type stmt_result = Mariadb_with_lwt.Res.t;
type error = Mariadb_with_lwt.error;
let wrap = (f, x) =>
Lwt.Infix.(
Lwt.catch(
() => Lwt_preemptive.detach(f, x) >>= (v => Lwt.return_ok(v)),
exn => Lwt.return_error(exn),
)
);
let create = Mariadb_with_lwt.prepare;
let close = Mariadb_with_lwt.Stmt.close;
let execute_null = (stmt, args) =>
wrap(Mariadb_with_lwt.Stmt.execute(stmt), args);
let fetch = Mariadb_with_lwt.Res.fetch;
};
});
The execute_null function takes a string option array, however from what I can tell ocaml-mariadb takes Field.t instances. I could write a small wrapper here but I'm not sure how to get type information out of the string option array passed to execute_null to map it to what ocaml-mariadb expects.
I'm unsure what the wrap function needs. The Mariadb_with_lwt is the lwt nonblocking implementation of ocaml-mariadb taken straight from their examples (mariadb_with_lwt.re). It appears that the type signatures are already result based so they don't need the exn -> result wrapping that is used for ocaml-mysql.
Possibly should be a separate issue but how would I use connection pooling? Would it beat all needed? I don't think either ocaml-mariadb or ocaml-mysql seems to support it? Does ppx_mysql have anything special for it?
The text was updated successfully, but these errors were encountered:
I use Mariadb as backend so I thought I'd use
ocaml-mariadb
instead ofocaml-mysql
as transport. The following code almost works (in the sense that it nearly builds, haven't actually run it yet) but I have a few questions.The
execute_null
function takes astring option array
, however from what I can tellocaml-mariadb
takes Field.t instances. I could write a small wrapper here but I'm not sure how to get type information out of thestring option array
passed toexecute_null
to map it to what ocaml-mariadb expects.I'm unsure what the
wrap
function needs. The Mariadb_with_lwt is the lwt nonblocking implementation of ocaml-mariadb taken straight from their examples (mariadb_with_lwt.re). It appears that the type signatures are alreadyresult
based so they don't need the exn -> result wrapping that is used for ocaml-mysql.Possibly should be a separate issue but how would I use connection pooling? Would it beat all needed? I don't think either ocaml-mariadb or ocaml-mysql seems to support it? Does ppx_mysql have anything special for it?
The text was updated successfully, but these errors were encountered: