X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2FmQIPostgres.ml;h=6f8a6f7ba5af27a48af61bdc80b97f0a6c668f19;hb=1c7fb836e2af4f2f3d18afd0396701f2094265ff;hp=fe4e3f6f95ac47d51dc9b9487e90de6687fd5191;hpb=48b9bb5e9504aba97cff28a9d7e2797feb42972e;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mQIPostgres.ml b/helm/ocaml/mathql_interpreter/mQIPostgres.ml index fe4e3f6f9..6f8a6f7ba 100644 --- a/helm/ocaml/mathql_interpreter/mQIPostgres.ml +++ b/helm/ocaml/mathql_interpreter/mQIPostgres.ml @@ -23,26 +23,18 @@ * http://cs.unibo.it/helm/. *) -let default_connection_string = - "dbname=mowgli_test user=helm" - -let connection = ref None - -let connection_string = - try Sys.getenv "POSTGRESQL_CONNECTION_STRING" - with Not_found -> default_connection_string +(* AUTOR: Ferruccio Guidi + *) -let init () = - try connection := Some (new Postgres.connection connection_string); +let init connection_string = + try Some (new Postgres.connection connection_string) with _ -> raise (Failure ("MQIPostgres.init: " ^ connection_string)) -let close () = match ! connection with +let close = function | None -> () | Some c -> c#close -let check () = ! connection <> None - -let exec q = match ! connection with +let exec c q = match c with | None -> [] | Some c -> (c#exec q)#get_list