diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine/lib/Doctrine/ORM/NativeQuery.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/doctrine/lib/Doctrine/ORM/NativeQuery.php Sat Sep 24 15:40:41 2011 +0200 @@ -0,0 +1,73 @@ +. + */ + +namespace Doctrine\ORM; + +/** + * Represents a native SQL query. + * + * @author Roman Borschel + * @since 2.0 + */ +final class NativeQuery extends AbstractQuery +{ + private $_sql; + + /** + * Sets the SQL of the query. + * + * @param string $sql + * @return NativeQuery This query instance. + */ + public function setSQL($sql) + { + $this->_sql = $sql; + return $this; + } + + /** + * Gets the SQL query. + * + * @return mixed The built SQL query or an array of all SQL queries. + * @override + */ + public function getSQL() + { + return $this->_sql; + } + + /** + * {@inheritdoc} + */ + protected function _doExecute() + { + $stmt = $this->_em->getConnection()->prepare($this->_sql); + $params = $this->_params; + foreach ($params as $key => $value) { + if (isset($this->_paramTypes[$key])) { + $stmt->bindValue($key, $value, $this->_paramTypes[$key]); + } else { + $stmt->bindValue($key, $value); + } + } + $stmt->execute(); + + return $stmt; + } +} \ No newline at end of file