From fd1cdc0fff3f15c67d949e016135c77c7c4a7ebd Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Thu, 3 Oct 2002 15:07:29 +0000 Subject: [PATCH] mqint updated --- helm/ocaml/mathql_interpreter/Makefile | 2 +- helm/ocaml/mathql_interpreter/dbconn.ml | 1 + helm/ocaml/mathql_interpreter/mqint.ml | 60 +++++++------------------ helm/ocaml/mathql_interpreter/mqint.mli | 2 + 4 files changed, 21 insertions(+), 44 deletions(-) diff --git a/helm/ocaml/mathql_interpreter/Makefile b/helm/ocaml/mathql_interpreter/Makefile index a8aea2b32..14cc838f9 100644 --- a/helm/ocaml/mathql_interpreter/Makefile +++ b/helm/ocaml/mathql_interpreter/Makefile @@ -8,7 +8,7 @@ IMPLEMENTATION_FILES = dbconn.ml utility.ml relation.ml diff.ml meet.ml sub.ml # $(INTERFACE_FILES:%.mli=%.ml) -EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_INSTALL = context.ml EXTRA_OBJECTS_TO_CLEAN = diff --git a/helm/ocaml/mathql_interpreter/dbconn.ml b/helm/ocaml/mathql_interpreter/dbconn.ml index d5db31252..a4bd7fe3b 100644 --- a/helm/ocaml/mathql_interpreter/dbconn.ml +++ b/helm/ocaml/mathql_interpreter/dbconn.ml @@ -71,6 +71,7 @@ let pgc () = let init () = try ( conn := Some (new Postgres.connection connection_param); + prerr_endline "connected." ) with _ -> raise (DBConnectionFailed ("init: " ^ connection_param)) ;; diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index f0fd0a7c0..af3298cce 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -77,25 +77,7 @@ let see_prop_pool () = (match !prop_pool with Some l -> l | _ -> print_endline "ciao"; assert false) ;; -(* - * inizializzazione della connessione al 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 - ) -;; + let get_prop_id prop = if prop="refObj" then "F" @@ -250,38 +232,30 @@ let execute q = MQList qq -> xres_to_res (execute_ex [] qq) ;; -(* - * chiusura della connessione al database - *) -let close () = Dbconn.close ();; +let prop_pool = ref None;; *****************************************************************************) -let prop_pool = ref None;; - +let init () = Dbconn.init () (* - * inizializzazione della connessione al 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#')" + 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 - ) - + ( + List.map + (function + a::b::_ -> (a, b) + | _ -> print_endline "no"; assert false + ) + res#get_list + ) +*) +let close () = Dbconn.close () +let check () = Dbconn.pgc () exception BooleExpTrue diff --git a/helm/ocaml/mathql_interpreter/mqint.mli b/helm/ocaml/mathql_interpreter/mqint.mli index 45e8b60ef..d86772622 100644 --- a/helm/ocaml/mathql_interpreter/mqint.mli +++ b/helm/ocaml/mathql_interpreter/mqint.mli @@ -28,3 +28,5 @@ val init : unit -> unit (* open database *) val execute : MathQL.query -> MathQL.result (* execute query *) val close : unit -> unit (* close database *) + +val check : unit -> Postgres.connection (* controllo connessione *) -- 2.39.2