X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2FmatitacleanLib.ml;h=51268acef0c8084216a7107346308b23813f3416;hb=28ac70d3f475442cda4ef30e0e9c0e6d012b2527;hp=d5e4c8ddeb05850e2efdb47b9bddbd2b2f85d983;hpb=efdb0db81ef2594a2aced0310997ef0d74462254;p=helm.git diff --git a/helm/matita/matitacleanLib.ml b/helm/matita/matitacleanLib.ml index d5e4c8dde..51268acef 100644 --- a/helm/matita/matitacleanLib.ml +++ b/helm/matita/matitacleanLib.ml @@ -47,15 +47,15 @@ let one_step_depend suri = Hashtbl.add cache_of_processed_baseuri buri true; let query = let buri = buri ^ "/" in - let buri = Mysql.escape buri in + let buri = HMysql.escape buri in let obj_tbl = MetadataTypes.obj_tbl () in Printf.sprintf "SELECT source, h_occurrence FROM %s WHERE h_occurrence LIKE '%s%%'" obj_tbl buri in try - let rc = Mysql.exec (MatitaDb.instance ()) query in + let rc = HMysql.exec (MatitaDb.instance ()) query in let l = ref [] in - Mysql.iter rc ( + HMysql.iter rc ( fun row -> match row.(0), row.(1) with | Some uri, Some occ when Filename.dirname occ = buri -> @@ -141,16 +141,19 @@ let clean_baseuris ?(verbose=true) buris = debug_prerr "clean_baseuri will remove:"; if debug then List.iter (fun u -> debug_prerr (UriManager.string_of_uri u)) l; - List.iter (MatitaSync.remove ~verbose) l; Hashtbl.iter (fun buri _ -> - MatitaMisc.safe_remove (MatitaMisc.obj_file_of_baseuri buri) - ) cache_of_processed_baseuri; + MatitaMisc.safe_remove (MatitaMisc.obj_file_of_baseuri buri)) + cache_of_processed_baseuri; + List.iter (MatitaSync.remove ~verbose) l; cleaned_no := !cleaned_no + List.length l; if !cleaned_no > 30 then - List.iter - (function table -> - ignore (Mysql.exec (MatitaDb.instance ()) ("OPTIMIZE TABLE " ^ table))) - [MetadataTypes.name_tbl (); MetadataTypes.rel_tbl (); - MetadataTypes.sort_tbl (); MetadataTypes.obj_tbl(); - MetadataTypes.count_tbl()] + begin + cleaned_no := 0; + List.iter + (function table -> + ignore (HMysql.exec (MatitaDb.instance ()) ("OPTIMIZE TABLE " ^ table))) + [MetadataTypes.name_tbl (); MetadataTypes.rel_tbl (); + MetadataTypes.sort_tbl (); MetadataTypes.obj_tbl(); + MetadataTypes.count_tbl()] + end