W3cubDocs

/Drupal 8

public function Select::forUpdate

public Select::forUpdate($set = TRUE)

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/Select.php, line 362

Class

Select
Query builder for SELECT statements.

Namespace

Drupal\Core\Database\Query

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Query!Select.php/function/Select::forUpdate/8.1.x