function UpdateQuery_sqlite::execute

Overrides UpdateQuery::execute

File

includes/database/sqlite/query.inc, line 69

Class

UpdateQuery_sqlite
SQLite specific implementation of UpdateQuery.

Code

public function execute() {
    if (!empty($this->queryOptions['sqlite_return_matched_rows'])) {
        return parent::execute();
    }
    // Get the fields used in the update query.
    $fields = $this->expressionFields + $this->fields;
    // Add the inverse of the fields to the condition.
    $condition = new DatabaseCondition('OR');
    foreach ($fields as $field => $data) {
        if (is_array($data)) {
            // The field is an expression.
            $condition->where($field . ' <> ' . $data['expression']);
            $condition->isNull($field);
        }
        elseif (!isset($data)) {
            // The field will be set to NULL.
            $condition->isNotNull($field);
        }
        else {
            $condition->condition($field, $data, '<>');
            $condition->isNull($field);
        }
    }
    if (count($condition)) {
        $condition->compile($this->connection, $this);
        $this->condition
            ->where((string) $condition, $condition->arguments());
    }
    return parent::execute();
}

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