Issue #2486831 by amateescu: The $dbh and $connection members are mixed up in Drupal\Core\Database\StatementPrefetch

8.0.x
Nathaniel Catchpole 2015-05-13 12:22:12 +01:00
parent e242632ca1
commit 60fbc1d59c
2 changed files with 13 additions and 17 deletions

View File

@ -84,7 +84,7 @@ class Statement extends StatementPrefetch implements StatementInterface {
}
}
return $this->dbh->prepare($query);
return $this->pdoConnection->prepare($query);
}
public function execute($args = array(), $options = array()) {

View File

@ -7,8 +7,6 @@
namespace Drupal\Core\Database;
use Drupal\Core\Database\Connection;
/**
* An implementation of StatementInterface that prefetches all data.
*
@ -31,21 +29,19 @@ class StatementPrefetch implements \Iterator, StatementInterface {
*/
protected $driverOptions;
/**
* Reference to the database connection object for this statement.
*
* This is part of the public interface of \PDOStatement.
*
* @var \PDO
*/
public $dbh;
/**
* Reference to the Drupal database connection object for this statement.
*
* @var \Drupal\Core\Database\Connection
*/
protected $connection;
public $dbh;
/**
* Reference to the PDO connection object for this statement.
*
* @var \PDO
*/
protected $pdoConnection;
/**
* Main data store.
@ -135,9 +131,9 @@ class StatementPrefetch implements \Iterator, StatementInterface {
*/
public $allowRowCount = FALSE;
public function __construct(\PDO $dbh, Connection $connection, $query, array $driver_options = array()) {
$this->dbh = $dbh;
$this->connection = $connection;
public function __construct(\PDO $pdo_connection, Connection $connection, $query, array $driver_options = array()) {
$this->pdoConnection = $pdo_connection;
$this->dbh = $connection;
$this->queryString = $query;
$this->driverOptions = $driver_options;
}
@ -165,7 +161,7 @@ class StatementPrefetch implements \Iterator, StatementInterface {
}
}
$logger = $this->connection->getLogger();
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
$query_start = microtime(TRUE);
}