From: Luca Padovani Date: Fri, 17 Oct 2003 09:53:46 +0000 (+0000) Subject: * oo interface X-Git-Tag: V_0_2_2~50 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=b488a9d40c305bced383a8ac2b38ea960d50041f;p=helm.git * oo interface --- diff --git a/helm/DEVEL/rdfly/query.ml b/helm/DEVEL/rdfly/query.ml index 2ea00d0c2..8e4ceb8ff 100644 --- a/helm/DEVEL/rdfly/query.ml +++ b/helm/DEVEL/rdfly/query.ml @@ -1,17 +1,16 @@ -let db = Postgres.Connection.connect "dbname=mowgli user=helm host=mowgli.cs.unibo.it" +module PG = Postgres -let _ = - let status = - match Postgres.Connection.status db with - Postgres.Connection.Ok -> "ok" - | _ -> "bad" - in - Printf.printf "connection status is %s\n" status ; - flush stdout +let db = + try + new PG.connection "dbname='mowgli_test' user='helm' host='mowgli.cs.unibo.it'" + with + PG.Error e as exc -> + prerr_endline (PG.string_of_error e) ; + raise exc -let res = Postgres.Connection.exec db "SELECT * FROM refObj WHERE source = 'cic:/Coq/Arith/Le/le_O_n.con';" +let res = db#exec "SELECT * FROM refObj WHERE source = 'cic:/Coq/Arith/Le/le_O_n.con';" let _ = - Printf.printf "# results: %d\n" (Postgres.Result.ntuples res) ; + Printf.printf "# results: %d\n" (res#ntuples) ; flush stdout