12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
-
-
- namespace Doctrine\ORM;
-
-
- final class NativeQuery extends AbstractQuery
- {
- private $_sql;
-
-
-
- public function setSQL($sql)
- {
- $this->_sql = $sql;
-
- return $this;
- }
-
-
-
- public function getSQL()
- {
- return $this->_sql;
- }
-
-
-
- protected function _doExecute()
- {
- $parameters = array();
- $types = array();
-
- foreach ($this->getParameters() as $parameter) {
- $name = $parameter->getName();
- $value = $this->processParameterValue($parameter->getValue());
- $type = ($parameter->getValue() === $value)
- ? $parameter->getType()
- : Query\ParameterTypeInferer::inferType($value);
-
- $parameters[$name] = $value;
- $types[$name] = $type;
- }
-
- if ($parameters && is_int(key($parameters))) {
- ksort($parameters);
- ksort($types);
-
- $parameters = array_values($parameters);
- $types = array_values($types);
- }
-
- return $this->_em->getConnection()->executeQuery(
- $this->_sql, $parameters, $types, $this->_queryCacheProfile
- );
- }
- }
|