function taxonomy_edge_get_root_pid in Taxonomy Edge 7.2
Get the path id for the root node in the tree. If root node is not present, create it and return that
Parameters
integer $vid: Vocabulary ID
Return value
integer Path ID
2 calls to taxonomy_edge_get_root_pid()
- taxonomy_edge_rebuild_edges in ./taxonomy_edge.rebuild.inc 
- Rebuild entire edge list.
- views_join_term_edge::build_join in views_taxonomy_edge/handlers/ views_join_term_edge.inc 
- Build the SQL for the join this object represents.
File
- ./taxonomy_edge.module, line 766 
- Selecting all children of a given taxonomy term can be a pain. This module makes it easier to do this, by maintaining a complete list of edges for each term using the adjecency matrix graph theory.
Code
function taxonomy_edge_get_root_pid() {
  static $pid = NULL;
  if (!$pid) {
    $pid = db_query("SELECT pid FROM {taxonomy_term_edge_path} WHERE tid = 0")
      ->fetchField();
    if (!$pid) {
      // Initial path
      $root = new stdClass();
      $root->tid = 0;
      $root->parent = 0;
      $root->vid = 0;
      drupal_write_record('taxonomy_term_edge_path', $root);
      $pid = $root->pid;
    }
  }
  return $pid;
}