X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2Frelation.ml;h=f2402688d70d1628e23e6a29d308d1d2555a4e4c;hb=3d828e15aa6d919eee55f8aa803f3512991e6693;hp=96b97f6578c727f4ac867a5ed0da38ebdc658b81;hpb=12274c7d0f49801a75e1f18ab181bed99ae66256;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/relation.ml b/helm/ocaml/mathql_interpreter/relation.ml index 96b97f657..f2402688d 100644 --- a/helm/ocaml/mathql_interpreter/relation.ml +++ b/helm/ocaml/mathql_interpreter/relation.ml @@ -36,6 +36,7 @@ open Union;; open Dbconn;; open Utility;; +let quoted s = Str.global_substitute (Str.regexp "'") (function _ -> "\\'") s (* Cerca in una lista di assegnamenti (lista di coppie (path,path) dove path e' di tipo (string * string list) quello relativo alla proprietà p e ne @@ -71,7 +72,7 @@ let relation_ex inv rop path rset assl = let c = pgc () in let rset_list = (* lista di singoletti:resource_set di un elemento *) (List.fold_left (fun acc (uri,l) -> - let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ uri ^ "'")) in + let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ quoted uri ^ "'")) in let qq = "select uri from t" ^ tv ^ " where prop_id='" ^ prop ^ "' order by uri asc" in (* print_endline qq; *) let res = c#exec qq in @@ -98,7 +99,7 @@ let relation_ex inv rop path rset assl = let c = pgc () in let rset_list = (* lista di singoletti:resource_set di un elemento *) (List.fold_left (fun acc (uri,l) -> - let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ uri ^ "'")) in + let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ quoted uri ^ "'")) in let qq = "select uri, position, depth from t" ^ tv ^ " where prop_id='" ^ prop ^ "' order by uri asc" in print_endline qq; let res = c#exec qq in @@ -117,7 +118,7 @@ let relation_ex inv rop path rset assl = [uri;position;depth] -> [(uri,[[((pos, []),[position])]])] | _ -> assert false ) res#get_list) @ acc - else (* voglio solo depth *) + else (* voglio solo depth *) (List.map (function [uri;position;depth] -> [(uri,[[((dep, []),[depth])]])]