You are here

public function SelectQuery::forUpdate in Drupal 7

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.


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

Return value

QueryConditionInterface The called object.

Overrides SelectQueryInterface::forUpdate

1 method overrides SelectQuery::forUpdate()
SelectQuery_sqlite::forUpdate in includes/database/sqlite/
Add FOR UPDATE to the query.


includes/database/, line 1167


Query builder for SELECT statements.


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