/** * execute query * * @param \Aura\SqlQuery\AbstractQuery|\Aura\SqlQuery\Common\SelectInterface|\Aura\SqlQuery\Common\ValuesInterface $queryObject * @return array * @throws \Exception */ public function query($queryObject) { $query = $queryObject->__toString(); $sth = self::$_connection->prepare($query); if (!$sth) { $err = self::$_connection->errorInfo(); throw new \Exception('DB Error: ' . $err[0] . ' - ' . $err[2]); } $values = $queryObject->getBindValues(); foreach ($values as $key => $val) { $sth->bindParam(':' . $key, $val); unset($val); } $res = $sth->execute(); if (!$res) { $err = $sth->errorInfo(); throw new \Exception('DB Error: ' . $err[0] . ' - ' . $err[2]); } return $sth; }
/** * {@inheritDoc} */ public function getStatement() { return QueryUtil::replaceNamedPlaceHolders($this->query->getStatement()); }
/** * {@inheritDoc} */ public function getBindValues() { return QueryUtil::reorderBindValues(parent::getBindValues(), parent::getStatement()); }