X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2FmQIMySql.ml;h=46f350e210dc25169ccb5c7f49e018d9ef520c70;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=e5cb01e4641f7489cabb48842a00062f11ea748c;hpb=52f0f77f24e6a1dfd2a1b277d6ade218039ba574;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mQIMySql.ml b/helm/ocaml/mathql_interpreter/mQIMySql.ml index e5cb01e46..46f350e21 100644 --- a/helm/ocaml/mathql_interpreter/mQIMySql.ml +++ b/helm/ocaml/mathql_interpreter/mQIMySql.ml @@ -27,11 +27,21 @@ *) 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 = @@ -46,7 +56,7 @@ let quote 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