/**
  * Save the Testresult for the given TestNode
  * @param tx_caretaker_TestNode $uid
  * @param tx_caretaker_TestResult $result tx_caretaker_TestResult
  */
 function saveTestResultForNode(tx_caretaker_TestNode $test, $testResult)
 {
     $values = array('test_uid' => $test->getUid(), 'instance_uid' => $test->getInstance()->getUid(), 'result_status' => TX_CARETAKER_UNDEFINED, 'tstamp' => $testResult->getTstamp(), 'result_status' => $testResult->getState(), 'result_value' => $testResult->getValue(), 'result_msg' => $testResult->getMessage()->getText(), 'result_values' => serialize($testResult->getMessage()->getValues()), 'result_submessages' => serialize($testResult->getSubMessages()));
     // store log of results
     $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_caretaker_testresult', $values);
     // store last results for fast access
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_caretaker_lasttestresult', 'test_uid = ' . $test->getUid() . ' AND instance_uid = ' . $test->getInstance()->getUid(), '', '', 1);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_caretaker_lasttestresult', 'uid = ' . $row['uid'], $values);
     } else {
         $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_caretaker_lasttestresult', $values);
     }
 }