From 94473157e4d94619ea29275ab7c16eaa90a16a92 Mon Sep 17 00:00:00 2001 From: natile Date: Thu, 3 Oct 2002 14:45:30 +0000 Subject: [PATCH] Db connection initialization --- helm/ocaml/mathql_interpreter/mqint.ml | 35 +++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index ba7d0713a..f0fd0a7c0 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -33,8 +33,9 @@ open MathQL;; open Eval;; open Utility;; -open Dbconn;; + open Pattern;;*) +open Dbconn;; open Union;; open Intersect;; open Meet;; @@ -256,9 +257,29 @@ let close () = Dbconn.close ();; *****************************************************************************) -let init () = () (* FG: implementare l'apertura del database *) +let prop_pool = ref None;; + +(* + * inizializzazione della connessione al database + *) + -let close () = () (* FG: implementare la chiusura del database *) +let init () = + let _ = Dbconn.init () in + let c = pgc () in + let res = + c#exec "select name,id from property where ns_id in (select id from namespace where url='http://www.cs.unibo.it/helm/schemas/mattone.rdf#')" + in + prop_pool := Some + ( + List.map + (function + a::b::_ -> (a, b) + | _ -> print_endline "no"; assert false + ) + res#get_list + ) + @@ -350,3 +371,11 @@ and exec_val_exp c = function and execute x = exec_set_exp {svars = []; rvars = []; groups = []; vvars = []} x + + + +(* + * chiusura della connessione al database + *) + let close () = Dbconn.close ();; + -- 2.39.2