/** * Save attachment meta data * * @return integer saved attachment id * * @todo implement update case */ public function saveMeta() { $faqattTableName = sprintf('%sfaqattachment', PMF_Db::getTablePrefix()); if (null == $this->id) { $this->id = $this->db->nextId($faqattTableName, 'id'); $sql = sprintf("\n INSERT INTO \n %s\n (id, record_id, record_lang, real_hash, virtual_hash,\n password_hash, filename, filesize, encrypted, mime_type)\n VALUES\n (%d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s')", $faqattTableName, $this->id, $this->recordId, $this->recordLang, $this->realHash, $this->virtualHash, $this->passwordHash, $this->filename, $this->filesize, $this->encrypted ? 1 : 0, $this->mimeType); $result = $this->db->query($sql); } else { // do update here } return $this->id; }