function StatementWrapper::__construct

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/StatementWrapper.php \Drupal\Core\Database\StatementWrapper::__construct()

Constructs a StatementWrapper object.

Parameters

\Drupal\Core\Database\Connection $connection: Drupal database connection object.

object $client_connection: Client database connection object, for example \PDO.

string $query: The SQL query string.

array $options: Array of query options.

bool $row_count_enabled: (optional) Enables counting the rows matched. Defaults to FALSE.

File

core/lib/Drupal/Core/Database/StatementWrapper.php, line 49

Class

StatementWrapper
Implementation of StatementInterface encapsulating PDOStatement.

Namespace

Drupal\Core\Database

Code

public function __construct(Connection $connection, $client_connection, string $query, array $options, bool $row_count_enabled = FALSE) {
    $this->connection = $connection;
    $this->clientStatement = $client_connection->prepare($query, $options);
    $this->rowCountEnabled = $row_count_enabled;
    $this->setFetchMode(\PDO::FETCH_OBJ);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.