statement = $statement; } public function closeCursor(): bool { $this->getResult()->closeCursor(); return true; } public function fetch(int $fetchMode = PDO::FETCH_ASSOC) { return $this->getResult()->fetch($fetchMode); } public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array { return $this->getResult()->fetchAll($fetchMode); } public function fetchColumn() { return $this->getResult()->fetchOne(); } public function fetchOne() { return $this->getResult()->fetchOne(); } public function bindValue($param, $value, $type = ParameterType::STRING): bool { return $this->statement->bindValue($param, $value, $type); } public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { return $this->statement->bindParam($param, $variable, $type, $length); } public function execute($params = null): IResult { return ($this->result = new ResultAdapter($this->statement->execute($params))); } public function rowCount(): int { return $this->getResult()->rowCount(); } private function getResult(): IResult { if ($this->result !== null) { return $this->result; } throw new Exception("You have to execute the prepared statement before accessing the results"); } }