You are here

function casetracker_update_10 in Case Tracker 5

File

./casetracker.install, line 317

Code

function casetracker_update_10() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $results = db_query("SELECT nid FROM {node} WHERE type = '%s'", 'casetracker_case');
      while ($result = db_fetch_array($results)) {

        // create case IDs for each casetracker case node.
        $scase_id = db_result(db_query("SELECT min(case_id) FROM {casetracker_case} WHERE nid = %d", $result['nid']));
        $ret[] = db_query("UPDATE {casetracker_case} SET case_id = %d where nid = %d", $scase_id, $result['nid']);
      }
      break;
  }
  return $ret;
}