Same name in this branch
  1. 10 core/lib/Drupal/Core/Database/Query/Delete.php \Drupal\Core\Database\Query\Delete::execute()
  2. 10 core/modules/pgsql/src/Driver/Database/pgsql/Delete.php \Drupal\pgsql\Driver\Database\pgsql\Delete::execute()
Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/Delete.php \Drupal\Core\Database\Query\Delete::execute()
  2. 9 core/lib/Drupal/Core/Database/Query/Delete.php \Drupal\Core\Database\Query\Delete::execute()

Executes the DELETE query.

Return value

int The number of rows affected by the delete query.

Overrides Query::execute

1 call to Delete::execute()
Delete::execute in core/modules/pgsql/src/Driver/Database/pgsql/Delete.php
Executes the DELETE query.
1 method overrides Delete::execute()
Delete::execute in core/modules/pgsql/src/Driver/Database/pgsql/Delete.php
Executes the DELETE query.

File

core/lib/Drupal/Core/Database/Query/Delete.php, line 50

Class

Delete
General class for an abstracted DELETE operation.

Namespace

Drupal\Core\Database\Query

Code

public function execute() {
  $values = [];
  if (count($this->condition)) {
    $this->condition
      ->compile($this->connection, $this);
    $values = $this->condition
      ->arguments();
  }
  $stmt = $this->connection
    ->prepareStatement((string) $this, $this->queryOptions, TRUE);
  try {
    $stmt
      ->execute($values, $this->queryOptions);
    return $stmt
      ->rowCount();
  } catch (\Exception $e) {
    $this->connection
      ->exceptionHandler()
      ->handleExecutionException($e, $stmt, $values, $this->queryOptions);
  }
}