*)
let init () =
- try Mysql.quick_connect
- ~host:"mowgli.cs.unibo.it" ~database:"mowgli" ~user:"helm" ()
+ let module HR = Helm_registry in
+ let host =
+ HR.get_opt HR.get_string "mathql_interpreter.mysql_connection.host" in
+ let database =
+ HR.get_opt HR.get_string "mathql_interpreter.mysql_connection.database" in
+ let user =
+ HR.get_opt HR.get_string "mathql_interpreter.mysql_connection.user" in
+ let port =
+ HR.get_opt HR.get_int "mathql_interpreter.mysql_connection.port" in
+ let password =
+ HR.get_opt HR.get_string "mathql_interpreter.mysql_connection.password" in
+ try HMysql.quick_connect ?host ?database ?user ?port ?password ()
with _ -> raise (Failure "mqi_connecion")
-let close c = Mysql.disconnect c
+let close c = HMysql.disconnect c
let quote s =
let rec quote_aux s =
let exec (c, out) q =
let g = function None -> "" | Some v -> v in
let f a = List.map g (Array.to_list a) in
- out q; Mysql.map ~f:f (Mysql.exec c q)
+ out q; HMysql.map ~f:f (Mysql.exec c q)
let exec c table cols ct cfl =
let rec iter f last sep = function