You are here

public function StatementWrapper::__construct in Drupal 9

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 affected. 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);
}