let unlink_table = fun table ->
let (tables, to_be_removed) =
List.partition (fun t -> t.ta_name <> table.ta_name)
table.ta_db.db_tables
in
let (t_use, t_dont_use) = vtables_using_table_part table
and (i_use, i_dont_use) = indexes_using_table_part table in
table.ta_db.db_tables <- tables;
table.ta_db.db_vtables <- t_dont_use;
table.ta_db.db_indexes <- i_dont_use;
match to_be_removed with
| [t] -> t.ta_db <- create_empty (); (t_use, i_use)
| _ -> Dbf_misc.ie ()