You are here

public function SelectExtender::forUpdate in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Query/SelectExtender.php \Drupal\Core\Database\Query\SelectExtender::forUpdate()
  2. 9 core/lib/Drupal/Core/Database/Query/SelectExtender.php \Drupal\Core\Database\Query\SelectExtender::forUpdate()

Add FOR UPDATE to the query.

FOR UPDATE prevents the rows retrieved by the SELECT statement from being modified or deleted by other transactions until the current transaction ends. Other transactions that attempt UPDATE, DELETE, or SELECT FOR UPDATE of these rows will be blocked until the current transaction ends.

Parameters

$set: IF TRUE, FOR UPDATE will be added to the query, if FALSE then it won't.

Return value

\Drupal\Core\Database\Query\ConditionInterface The called object.

Overrides SelectInterface::forUpdate

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 433

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function forUpdate($set = TRUE) {
  $this->query
    ->forUpdate($set);
  return $this;
}