stmt = $stmt; $this->pdo = $pdo; $this->isQuery = $isQuery; } public function bind($param, $value, int $dataType = PDO::PARAM_STR): DatabaseStatement { $this->stmt->bindValue($param, $value, $dataType); return $this; } public function execute(array $params = []): bool { return count($params) ? $this->stmt->execute($params) : $this->stmt->execute(); } public function executeGetId(array $params = []): int { return $this->execute($params) ? $this->pdo->lastInsertId() : 0; } public function fetch($default = []) { $out = $this->isQuery || $this->execute() ? $this->stmt->fetch(PDO::FETCH_ASSOC) : false; return $out ? $out : $default; } public function fetchAll($default = []) { $out = $this->isQuery || $this->execute() ? $this->stmt->fetchAll(PDO::FETCH_ASSOC) : false; return $out ? $out : $default; } public function fetchColumn(int $num = 0, $default = null) { $out = $this->isQuery || $this->execute() ? $this->stmt->fetchColumn($num) : false; return $out ? $out : $default; } }