]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/pattern.ml
final ispell
[helm.git] / helm / ocaml / mathql_interpreter / pattern.ml
index 5fddf5729b4a9a7e719c9c5970bc0eee31758732..5dcb8a585dfee96099f4636396a42ce571851ee0 100644 (file)
@@ -23,7 +23,6 @@
  * http://www.cs.unibo.it/helm/.
  *)
 
-open Dbconn;;
 open Utility;;
 
 let cat l1 l2 =
@@ -33,12 +32,15 @@ let cat l1 l2 =
         l1 @ l2
 ;;
 
-let rec pattern_ex l =
+let rec pattern_ex handle l =
   match l with
      [] -> []
    | s::tl -> let result = 
-             let c = pgc () in
-             let qq = "select uri from registry where uri ~ '" ^ s ^ "' order by registry.uri asc" in
+             let c = MQIConn.pgc handle in
+             let quoted_s =
+              Str.global_substitute (Str.regexp "'")
+               (function _ -> "\\'") s in
+             let qq = "select uri from registry where uri ~ '" ^ quoted_s ^ "' order by registry.uri asc" in
              let res = c#exec (qq) in
              List.map (function uri -> (List.hd uri,[])) res#get_list
              (*for i = 0 to res#ntuples do 
@@ -46,6 +48,6 @@ let rec pattern_ex l =
              done*)
 
             in
-            cat result (pattern_ex tl)
+            cat result (pattern_ex handle tl)
 ;;