]> matita.cs.unibo.it Git - helm.git/blobdiff - components/library/libraryClean.ml
hSqlite3.ml used create_fun_2 to define REGEXP.
[helm.git] / components / library / libraryClean.ml
index 54aa860c9b290acb5b72bd86d7ca31983e0fd1d8..46e2dd18cc2c8d56ca72fa56d2bb52082eba3675 100644 (file)
@@ -51,17 +51,20 @@ let one_step_depend suri =
         let buri = buri ^ "/" in 
         let buri = HSql.escape buri in
         let obj_tbl = MetadataTypes.obj_tbl () in
-       if HSql.isMysql then        
-         sprintf ("SELECT source, h_occurrence FROM %s WHERE " 
-         ^^ "h_occurrence REGEXP '^%s[^/]*$'") obj_tbl buri
-       else
-        begin
+        if HSql.isMysql then        
+          sprintf ("SELECT source, h_occurrence FROM %s WHERE " 
+            ^^ "h_occurrence REGEXP '^%s[^/]*$'") obj_tbl buri
+       else
+               begin
+            sprintf ("SELECT source, h_occurrence FROM %s WHERE " 
+            ^^ "REGEXP(h_occurrence, '^%s[^/]*$')") obj_tbl buri
+          (* implementation with vanilla ocaml-sqlite3
           HLog.debug "Warning SELECT without REGEXP";
-         sprintf
-          ("SELECT source, h_occurrence FROM %s WHERE " ^^ 
-          "h_occurrence LIKE '%s%%'")
-         obj_tbl buri
-        end
+         sprintf
+            ("SELECT source, h_occurrence FROM %s WHERE " ^^ 
+             "h_occurrence LIKE '%s%%'")
+                 obj_tbl buri*)
+               end
       in
       try 
         let rc = HSql.exec (LibraryDb.instance ()) query in
@@ -94,11 +97,15 @@ let db_uris_of_baseuri buri =
     ^^ "source REGEXP '^%s[^/]*$'") obj_tbl buri
   else
    begin
+    sprintf ("SELECT source FROM %s WHERE " 
+      ^^ "REGEXP(source, '^%s[^/]*$')") obj_tbl buri
+     (* implementation with vanilla ocaml-sqlite3
     HLog.debug "Warning SELECT without REGEXP";
     sprintf
     ("SELECT source, h_occurrence FROM %s WHERE " ^^ 
     "h_occurrence LIKE '%s%%'")
     obj_tbl buri
+    *)
    end
  in
  try