function tripal_update_cvtermpath_old
3.x tripal_chado.cv.api.inc | tripal_update_cvtermpath_old($cv_id, $job_id = NULL) |
Updates the cvtermpath table of Chado for the specified CV.
Parameters
$cv_id: The chado cv_id.
$job_id: This function is intended to be used with the Tripal Jobs API. When this function is called as a job the $job_id is automatically passed to this function.
Return value
TRUE on success FALSE on failure.
Related topics
File
- tripal_chado/
api/ modules/ tripal_chado.cv.api.inc, line 345 - Provides API functions specificially for managing controlled vocabulary records in Chado.
Code
function tripal_update_cvtermpath_old($cv_id, $job_id = NULL) {
// TODO: need better error checking in this function
// First get the controlled vocabulary name:
$sql = "SELECT * FROM {cv} WHERE cv_id = :cv_id";
$cv = chado_query($sql, array(':cv_id' => $cv_id))->fetchObject();
print "\nUpdating cvtermpath for $cv->name...\n";
// We need to set the chado schema as active because some of the
// functions call other functions which would not be in scope.
$previous = chado_set_active('chado');
try {
$sql = "SELECT * FROM fill_cvtermpath(:name)";
db_query($sql, array(':name' => $cv->name));
chado_set_active($previous);
}
catch (Exception $e) {
chado_set_active($previous);
$error = $e->getMessage();
tripal_report_error('tripal_chado', TRIPAL_ERROR, "Could not fill cvtermpath table: @error", array('@error' => $error));
return FALSE;
}
return TRUE;
}