private function save() { global $conf; VHFFS_db::get()->beginTransaction(); $sql = "LOCK TABLE " . $conf['postgresql_tablename'] . " IN EXCLUSIVE MODE"; $res = VHFFS_db::get()->exec($sql); $sql = "\n\t\tUPDATE " . $conf['postgresql_tablename'] . "\n\t\tSET httpd_id = :httpd_id,\n\t\t\tcertificate_date = :certificate_date,\n\t\t\terror_log = :error_log\n\t\tWHERE httpd_id = :httpd_id"; $st = VHFFS_db::get()->prepare($sql); $array = array('httpd_id' => $this->httpd_id, 'certificate_date' => $this->certificate_date, 'error_log' => $this->error_log); VHFFS_db::bindArrayValue($st, $array); $res = $st->execute(); if ($st->errorCode() != 0) { echo '<pre>' . $sql . '</pre>'; foreach ($st->errorInfo() as $info) { echo $info . '<br>'; } die; } $row_count = $st->rowCount(); // var_dump($row_count); if ($row_count === 0) { $sql = "\n\t\t\tINSERT INTO " . $conf['postgresql_tablename'] . " (httpd_id, certificate_date, error_log)\n\t\t\tVALUES (:httpd_id, :certificate_date, :error_log)"; $st = VHFFS_db::get()->prepare($sql); $array = array('httpd_id' => $this->httpd_id, 'certificate_date' => $this->certificate_date, 'error_log' => $this->error_log); VHFFS_db::bindArrayValue($st, $array); $res = $st->execute(); if ($st->errorCode() != 0) { echo '<pre>' . $sql . '</pre>'; foreach ($st->errorInfo() as $info) { echo $info . '<br>'; } die; } $row_count = $st->rowCount(); // var_dump($row_count); } VHFFS_db::get()->commit(); }