From b488a9d40c305bced383a8ac2b38ea960d50041f Mon Sep 17 00:00:00 2001 From: Luca Padovani Date: Fri, 17 Oct 2003 09:53:46 +0000 Subject: [PATCH] * oo interface --- helm/DEVEL/rdfly/query.ml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) 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 -- 2.39.2