* http://cs.unibo.it/helm/.
*)
-let default_connection_string =
- "dbname=mowgli_test user=helm"
+(* AUTOR: Ferruccio Guidi <fguidi@cs.unibo.it>
+ *)
-let connection = ref None
+let default_connection_string =
+ "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