function Schema::executeDdlStatement

Executes a data definition language (DDL) statement.

This method allows to void an active transaction when the driver does not support transactional DDL.

Parameters

string $sql: The DDL statement to execute. This is a SQL string that may contain placeholders.

array $arguments: (Optional) The associative array of arguments for the prepared statement.

array $options: (Optional) An associative array of options to control how the query is run. The given options will be merged with self::defaultOptions().

30 calls to Schema::executeDdlStatement()
Schema::addField in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Add a new field to a table.
Schema::addField in core/modules/sqlite/src/Driver/Database/sqlite/Schema.php
Add a new field to a table.
Schema::addField in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Add a new field to a table.
Schema::addIndex in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Add an index.
Schema::addIndex in core/modules/sqlite/src/Driver/Database/sqlite/Schema.php
Add an index.

... See full list

File

core/lib/Drupal/Core/Database/Schema.php, line 136

Class

Schema
Provides a base implementation for Database Schema.

Namespace

Drupal\Core\Database

Code

protected function executeDdlStatement(string $sql, array $arguments = [], array $options = []) : void {
  $this->connection
    ->query($sql, $arguments, $options);
  // DDL statements when in a transaction force a commit in some databases.
  // Void the transaction in that case.
  if (!$this->connection
    ->supportsTransactionalDDL() && $this->connection
    ->transactionManager()
    ->inTransaction()) {
    $this->connection
      ->transactionManager()
      ->voidClientTransaction();
  }
}

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