function Delete::execute

Same name in this branch
  1. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Delete.php \Drupal\pgsql\Driver\Database\pgsql\Delete::execute()
Same name in other branches
  1. 9 core/modules/pgsql/src/Driver/Database/pgsql/Delete.php \Drupal\pgsql\Driver\Database\pgsql\Delete::execute()
  2. 9 core/lib/Drupal/Core/Database/Query/Delete.php \Drupal\Core\Database\Query\Delete::execute()
  3. 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Delete.php \Drupal\Core\Database\Driver\pgsql\Delete::execute()
  4. 8.9.x core/lib/Drupal/Core/Database/Query/Delete.php \Drupal\Core\Database\Query\Delete::execute()
  5. 10 core/modules/pgsql/src/Driver/Database/pgsql/Delete.php \Drupal\pgsql\Driver\Database\pgsql\Delete::execute()
  6. 10 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 46

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

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