/** * Execute the query and update the expected entries in the database. * * @throws \Exception When an error occur while updating. */ public function execute() { $query = $this->factory->builder($this->update)->process(); $result = $this->pdo->query($query); if (!$result) { throw new \Exception('An error while updating is occurred'); } }
/** * Execute the query and insert the expected entries in the database. * * @throws \Exception When an error is occurred while the insertion. */ public function execute() { $query = $this->factory->builder($this->insert)->process(); $result = $this->pdo->query($query); if (!$result) { throw new \Exception('An error is while the insertion occurred! (query: "' . $query . '")'); } return $this->pdo->lastInsertId(); }