By calling function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL), an array of all term objects is returned. Extra parameters can be added to the function to select all items belonging to a particular parent or limit depth of the tree. By calling function taxonomy_term_delete($tid), a new db_transaction() starts and the taxonomy object and all its children are deleted from the taxomy_term_data and taxonomy_term_hierarchy tables. As a taxonomy term is an entity which has attached fields, all attached field data is also deleted. Finally, the function clears all static cache variables for terms by using taxonomy_terms_static_reset().