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)

Removes analysis from the chado database

Parameters

$node: The node object specifying which chado record to delete

Related topics

File

tripal_analysis/tripal_analysis.module, line 250
Contains all the main hook implementations for the tripal_analysis module

Code

function chado_analysis_delete($node) {
  $analysis_id = chado_get_id_for_node('analysis', $node);

  // if we don't have an organism id for this node then this isn't a node of
  // type chado_organism or the entry in the chado_organism 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 = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node} " .
    "WHERE nid = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node_revisions} " .
    "WHERE nid = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);

  //Remove from analysis and analysisprop tables of chado database as well
  chado_query("DELETE FROM {analysis} WHERE analysis_id = %d", $analysis_id);
}