X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmetadata%2Ftest.ml;h=21274a585e37020c4652a1f865439191e8f3b9ed;hb=3cf0591648726eee39e584ce3572d15224cf39b7;hp=27be47c23cb1c545c14eef1e3241764f9ff66e96;hpb=21758b512843088d19e81830d9fb121725c8a16e;p=helm.git diff --git a/helm/ocaml/metadata/test.ml b/helm/ocaml/metadata/test.ml index 27be47c23..21274a585 100644 --- a/helm/ocaml/metadata/test.ml +++ b/helm/ocaml/metadata/test.ml @@ -1,23 +1,37 @@ -module DB = Dbi_mysql - let _ = Helm_registry.set "getter.mode" "remote"; let _ = Helm_registry.set "getter.url" "http://mowgli.cs.unibo.it:58081/" in -let dbh = new DB.connection ~host:"mowgli.cs.unibo.it" ~user:"helm" "matita" in +let dbd = + Mysql.quick_connect ~host:"mowgli.cs.unibo.it" ~user:"helm" ~database:"matita" + () +in let owner = try Sys.argv.(2) with Invalid_argument _ -> "matita_test" in -if Sys.argv.(1) = "clean" then - MetadataDb.clean ~dbh ~owner -else - let uri_str = Sys.argv.(1) in - let uri = UriManager.uri_of_string uri_str in - match CicEnvironment.get_obj uri with - | Cic.Constant (_, body, ty, _) -> - MetadataDb.index_constant ~body ~ty ~uri ~owner ~dbh - | Cic.InductiveDefinition (types, _, _) -> - MetadataDb.index_inductive_def ~dbh ~owner ~uri ~types - | _ -> assert false +let _ = MetadataTypes.ownerize_tables owner in +if Sys.argv.(1) = "clean" then begin + prerr_endline "foo"; + ignore (MetadataDb.clean ~dbd) +end else + let fname = Sys.argv.(1) in + let n = ref 0 in + let ic = open_in fname in + try + while true do + let line = input_line ic in + incr n; + Printf.printf "%d\t%s\n" !n line; flush stdout; + let uri = UriManager.uri_of_string line in + (match CicEnvironment.get_obj CicUniv.empty_ugraph uri with + | Cic.Constant (_, body, ty, _, _), _ -> + MetadataDb.index_constant ~body ~ty ~uri ~dbd + | Cic.Variable (_, body, ty, _, _), _ -> + MetadataDb.index_constant ~body ~ty ~uri ~dbd + | Cic.InductiveDefinition (types, _, _, _), _ -> + MetadataDb.index_inductive_def ~dbd ~uri ~types + | _ -> assert false) + done + with End_of_file -> close_in ic