Commit 513228d7 authored by Matty Driessen's avatar Matty Driessen

Portability wrapper did not properly use the _defaultFetchMode when the method...

Portability wrapper did not properly use the _defaultFetchMode when the method setFetchMode() was used on the Connection
parent 3253f7a1
...@@ -177,7 +177,7 @@ class Connection implements DriverConnection ...@@ -177,7 +177,7 @@ class Connection implements DriverConnection
/** /**
* @var integer * @var integer
*/ */
private $_defaultFetchMode = PDO::FETCH_ASSOC; protected $_defaultFetchMode = PDO::FETCH_ASSOC;
/** /**
* Initializes a new instance of the Connection class. * Initializes a new instance of the Connection class.
......
...@@ -22,6 +22,13 @@ namespace Doctrine\DBAL\Portability; ...@@ -22,6 +22,13 @@ namespace Doctrine\DBAL\Portability;
use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Cache\QueryCacheProfile;
/**
* Portability wrapper for a Connection.
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class Connection extends \Doctrine\DBAL\Connection class Connection extends \Doctrine\DBAL\Connection
{ {
const PORTABILITY_ALL = 255; const PORTABILITY_ALL = 255;
...@@ -105,7 +112,10 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -105,7 +112,10 @@ class Connection extends \Doctrine\DBAL\Connection
*/ */
public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null) public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
{ {
return new Statement(parent::executeQuery($query, $params, $types, $qcp), $this); $stmt = new Statement(parent::executeQuery($query, $params, $types, $qcp), $this);
$stmt->setFetchMode($this->_defaultFetchMode);
return $stmt;
} }
/** /**
...@@ -113,7 +123,10 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -113,7 +123,10 @@ class Connection extends \Doctrine\DBAL\Connection
*/ */
public function prepare($statement) public function prepare($statement)
{ {
return new Statement(parent::prepare($statement), $this); $stmt = new Statement(parent::prepare($statement), $this);
$stmt->setFetchMode($this->_defaultFetchMode);
return $stmt;
} }
/** /**
...@@ -124,7 +137,9 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -124,7 +137,9 @@ class Connection extends \Doctrine\DBAL\Connection
$this->connect(); $this->connect();
$stmt = call_user_func_array(array($this->_conn, 'query'), func_get_args()); $stmt = call_user_func_array(array($this->_conn, 'query'), func_get_args());
$stmt = new Statement($stmt, $this);
$stmt->setFetchMode($this->_defaultFetchMode);
return new Statement($stmt, $this); return $stmt;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment