Exemplo n.º 1
0
 public function Save(WQDData $wqdData)
 {
     $fields = "wqdfileseq,wqdfolderseq,wqdfiledatadated,wqdfiledatareportno,wqdfiledatatotalchannels,wqdfiledatachecksum,";
     $values = ":fileseq,:folderseq,:datadate,:reportno,:totalChannels,:datachecksum,";
     $conn = self::$db->getConnection();
     $WCD = WQDDataChannelDataStore::getInstance();
     $wqdChannlsArr = array();
     try {
         $wqdChannlsArr = $wqdData->getChannels();
         $SQL = self::GenerateSqlToSave($wqdChannlsArr, $fields, $values);
         $stmt = $conn->prepare($SQL);
         $stmt->bindValue(':fileseq', 0);
         $stmt->bindValue(':folderseq', $wqdData->getFolderSeq());
         $stmt->bindValue(':datadate', $wqdData->getDatadate());
         $stmt->bindValue(':reportno', $wqdData->getReportNo());
         $stmt->bindValue(':totalChannels', $wqdData->getTotalChannels());
         $stmt->bindValue(':datachecksum', $wqdData->getChecksum());
         $stmt->execute();
         $error = $stmt->errorInfo();
         if ($error[2] != "") {
             throw new RuntimeException($error[2]);
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if (strpos($message, "Duplicate entry") === 0) {
         } else {
             throw $e;
         }
     }
 }