X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2FmQIPostgres.ml;h=b19a51c83bbb0ccfde390b50ae485df1e8a3a0ed;hb=91db309a46f8b6f100a36abbc568deec10a8d1df;hp=fe4e3f6f95ac47d51dc9b9487e90de6687fd5191;hpb=d59d2f93956bcbe4dd7bb3407e3c53de8b66c003;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mQIPostgres.ml b/helm/ocaml/mathql_interpreter/mQIPostgres.ml index fe4e3f6f9..b19a51c83 100644 --- a/helm/ocaml/mathql_interpreter/mQIPostgres.ml +++ b/helm/ocaml/mathql_interpreter/mQIPostgres.ml @@ -24,25 +24,21 @@ *) 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