public function Save(ChannelConfiguration $cc) { $SQL = self::$INSERT; $conn = self::$db->getConnection(); $stmt = $conn->prepare($SQL); $stmt->bindValue(':folderseq', $cc->getFolderSeq()); $stmt->bindValue(':channelnumber', $cc->getChannelNumber()); $stmt->bindValue(':channelname', $cc->getChannelName()); $stmt->bindValue(':channelstatusflag', $cc->getChannelStatusFlag()); $stmt->bindValue(':channelunit', $cc->getChannelUnit()); try { $stmt->execute(); $err = $stmt->errorInfo(); } catch (Exception $e) { return $e->getMessage(); } $error = $stmt->errorInfo(); }
public function Save(ChannelConfiguration $cc) { $isUpdate = false; $seq = $cc->getSeq(); if (!empty($seq)) { $isUpdate = true; } $SQL = $isUpdate ? self::$UPDATE : self::$INSERT; $conn = self::$db->getConnection(); $stmt = $conn->prepare($SQL); $stmt->bindValue(':folderseq', $cc->getFolderSeq()); $stmt->bindValue(':channelnumber', $cc->getChannelNumber()); $stmt->bindValue(':channelname', $cc->getChannelName()); $stmt->bindValue(':channelstatusflag', $cc->getChannelStatusFlag()); $stmt->bindValue(':channelstation', $cc->getChannelStation()); $stmt->bindValue(':channelunit', $cc->getChannelUnit()); $stmt->bindValue(':prescribedlimit', $cc->getPrescribedLimit()); if ($isUpdate) { $stmt->bindValue(':configseq', $cc->getSeq()); } try { $stmt->execute(); $err = $stmt->errorInfo(); if ($err[2] != "") { throw new RuntimeException($err[2]); } } catch (Exception $e) { $logger = Logger::getLogger(""); $logger->error("Error during Save ChannelConfiguration : - " . $e->getMessage()); return $e->getMessage(); } }