]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mQIPostgres.ml
MathQL 1.3 ready for use
[helm.git] / helm / ocaml / mathql_interpreter / mQIPostgres.ml
index fe4e3f6f95ac47d51dc9b9487e90de6687fd5191..b19a51c83bbb0ccfde390b50ae485df1e8a3a0ed 100644 (file)
  *)
 
 let default_connection_string =
-   "dbname=mowgli_test user=helm"
-
-let connection = ref None
+   "dbname=mowgli user=helm"
 
 let connection_string =
    try Sys.getenv "POSTGRESQL_CONNECTION_STRING"
    with Not_found -> default_connection_string 
 
 let init () =
-   try connection := Some (new Postgres.connection 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