function chado_analysis_delete
2.x tripal_analysis.chado_node.inc | chado_analysis_delete($node) |
3.x tripal_analysis.chado_node.inc | chado_analysis_delete($node) |
1.x tripal_analysis.module | chado_analysis_delete($node) |
Implements hook_delete(). Removes analysis from the chado database.
Related topics
File
- tripal_analysis/
includes/ tripal_analysis.chado_node.inc, line 487 - Implements Drupal Node hooks to create the chado_analysis node content type.
Code
function chado_analysis_delete($node) {
$analysis_id = chado_get_id_from_nid('analysis', $node->nid);
// if we don't have an analysis id for this node then this isn't a node of
// type chado_analysis or the entry in the chado_analysis table was lost.
if (!$analysis_id) {
return;
}
// Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
$sql_del = "DELETE FROM {chado_analysis} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
$sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
$sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
//Remove from analysis and analysisprop tables of chado database as well
chado_query("DELETE FROM {analysis} WHERE analysis_id = :analysis_id", array(':analysis_id' => $analysis_id));
}