List.iter (fun (uri, name, _) -> insert_name ~dbd ~uri ~name) metadata
end
+let tables_to_clean =
+ [sort_tbl; rel_tbl; obj_tbl; conclno_tbl; conclno_hyp_tbl; name_tbl]
+
let clean ~(dbd:Mysql.dbd) =
let owned_uris = (* list of uris in list-of-columns format *)
let query = sprintf "SELECT source FROM %s" (obj_tbl ()) in
(fun source_col -> ignore (Mysql.exec dbd (query source_col)))
owned_uris
in
- List.iter del_from
- [sort_tbl; rel_tbl; obj_tbl; conclno_tbl; conclno_hyp_tbl; name_tbl];
+ List.iter del_from tables_to_clean;
owned_uris
+let unindex ~dbd ~uri =
+ let uri = UriManager.string_of_uri uri in
+ let del_from tbl =
+ let query tbl =
+ sprintf "DELETE FROM %s WHERE source LIKE \"%s%%\"" (tbl ()) uri
+ in
+ ignore (Mysql.exec dbd (query tbl))
+ in
+ List.iter del_from tables_to_clean
+