Generate an "update" query

@param Update $update
@return string
@throws Exception
501073
public function getUpdateSQL(Update $update)
        {
            if (!$this->query->getTable() instanceof Table) {
                throw new Exception('Trying to generate sql when no table is being used.');
            }
            $sql = $this->generateUpdateSQL($update);
            $sql .= $this->generateWhereSQL(true);

            return $sql;
        }
377308
protected function getSqlForUpdate()
    {
        $query = 'UPDATE ' . $this->getFrom()
            . ' SET ' . implode(", ", $this->sqlParts['set'])
            . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string)$this->sqlParts['where']) : '');
        return $query;
    }
603683
public function update($fields)
    {
        // Set fields
        $this->fields($fields);

        // Resolve fields
        $fields = $this->getUpdateFieldsString();

        // Define wheres
        $where = $this->getWhereString();

        // Build query
        $this->query = 'UPDATE ' . $this->table . ' SET ' . $fields . ' '. $where;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind fields values
        $this->bindFields();

        // Bind where values
        if (count($this->wheres)) {
            $this->bindWheres();
        }

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
783433
public function update(KDatabaseQueryUpdate $query)
    {
        $context = $this->getContext();
        $context->query = $query;

        //Execute the update operation
        if ($this->invokeCommand('before.update', $context) !== false)
        {
            if (!empty($context->query->values))
            {
                //Execute the query
                $context->result   = $this->execute($context->query);
                $context->affected = $this->_affected_rows;

                $this->invokeCommand('after.update', $context);
            }
            else $context->affected = false;
        }

        return $context->affected;
    }
125295
private function getUpdateQuery()
    {
        if (isset($this->parts['from'][0]['alias'])) {
            $fromClause = $this->parts['from'][0]['alias'].' FROM '.$this->getFromClause();
        } else {
            $fromClause = $this->parts['from'][0]['table'];
        }

        $setClause = array();

        foreach ($this->parts['set'] as $idenfier => $value) {
            $setClause[] = $this->getExpressionBuilder()->equal($idenfier, $value);
        }

        return 'UPDATE '.$fromClause.
               ' SET '.implode(', ', $setClause).
               (($this->parts['where'] !== null) ? ' WHERE '.$this->parts['where'] : null);
    }
87912
protected function update($step)
    {
        $sectionCollection = $this->matchSections('update', $step);

        if (count($sectionCollection) > 1 && array_key_exists('references', $step->dsl)) {
            throw new \Exception("Can not execute Section update because multiple sections match, and a references section is specified in the dsl. References can be set when only 1 section matches");
        }

        $sectionService = $this->repository->getSectionService();
        foreach ($sectionCollection as $key => $section) {
            $sectionUpdateStruct = $sectionService->newSectionUpdateStruct();

            if (isset($step->dsl['identifier'])) {
                $sectionUpdateStruct->identifier = $this->referenceResolver->resolveReference($step->dsl['identifier']);
            }
            if (isset($step->dsl['name'])) {
                $sectionUpdateStruct->name = $this->referenceResolver->resolveReference($step->dsl['name']);
            }

            $section = $sectionService->updateSection($section, $sectionUpdateStruct);

            $sectionCollection[$key] = $section;
        }

        $this->setReferences($sectionCollection, $step);

        return $sectionCollection;
    }
573033
private function getSQLForUpdate()
    {
        $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');

        return 'UPDATE ' . $table
            . ' SET ' . implode(', ', $this->sqlParts['set'])
            . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
    }
290040
public function compileUpdate(string $table, array $updates, array $whereTokens = []): string
    {
        $table = $this->quote($table, true);

        //Preparing update column statement
        $updates = $this->prepareUpdates($updates);

        //Where statement is optional for update queries
        $whereStatement = $this->optional("\nWHERE", $this->compileWhere($whereTokens));

        return rtrim("UPDATE {$table}\nSET {$updates} {$whereStatement}");
    }
613875
protected function buildUpdateUpdatePayload(Update $update)
    {
        $payload = array(
            'text' => $update->text,
            'now' => $update->now,
        );

        if ( ! empty($update->media)) {
            $payload['media'] = $update->media;
        }

        if ( ! is_null($update->scheduled_at)) {
            $payload['scheduled_at'] = $update->scheduled_at;
        }

        return $payload;
    }
135595
public function buildUpdate(Query $query) {
        return $this->renderStatement(Query::UPDATE, [
            'fields' => $this->formatFields($query),
            'table' => $this->formatTable($query->getTable(), $query->getAlias()),
            'joins' => $this->formatJoins($query->getJoins()),
            'where' => $this->formatWhere($query->getWhere()),
            'orderBy' => $this->formatOrderBy($query->getOrderBy()),
            'limit' => $this->formatLimit($query->getLimit()),
        ] + $this->formatAttributes($query->getAttributes()));
    }
1259587
private function internalUpdate()
    {
        if ($this->triggerEvent(self::EVENT_NAME_BEFORE_UPDATE)->isCancelled()) {
            return;
        }

        // locking
        $query = array('_id' => $this->getId());
        if ($this->getOption('lock') === Definition::LOCK_OPTIMISTIC) {
            $query['__version__'] = $this->get('__version__');
            $this->getOperator()->increment('__version__');
        }

        // update
        try {
            $status = $this
                ->collection
                ->getMongoCollection()
                ->update(
                    $query,
                    $this->getOperator()->toArray()
                );
        } catch (\Exception $e) {
            throw new WriteException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        }

        // check update status
        if ($status['ok'] != 1) {
            throw new WriteException(
                sprintf(
                    'Update error: %s: %s',
                    $status['err'],
                    $status['errmsg']
                )
            );
        }

        // check if document modified due to specified lock
        if ($this->getOption('lock') === Definition::LOCK_OPTIMISTIC) {
            if ($status['n'] === 0) {
                throw new OptimisticLockFailureException;
            }
        }

        if ($this->getOperator()->isReloadRequired()) {
            $this->refresh();
        } else {
            $this->getOperator()->reset();
        }

        $this->triggerEvent(self::EVENT_NAME_AFTER_UPDATE);
    }
177598
public function executeUpdates($updates) {
    /** @var Updates $updates_object */
    $updates_object = new $this->updateClassName($this);
    $this->output->writeln("Executing updates...");

    /**
     * @var string $method_name
     * @var Update $update
     */
    foreach ($updates as $method_name => $update) {
      $this->output->writeln("-> $method_name: {$update->description}");
      call_user_func([$updates_object, $method_name]);
    }
  }
1178062
public function execute()
	{
		$query  = $this->factory->builder($this->update)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error while updating is occurred');
		}
	}
548001
public function processCommand(Update $update)
    {
        $message = $update->getMessage();

        if ($message !== null && $message->has('text')) {
            $this->getCommandBus()->handler($message->getText(), $update);
        }
    }
165182
private function buildUpdateSql(): string
    {
        $sql = 'UPDATE ' . $this->tableName . ' SET ';
        $fieldArr = [];
        foreach ($this->updateData as $key => $value) {
            if ($value === null) {
                $fieldArr[] = ($key . '=NULL');
            } elseif (is_string($value)) {
                $fieldArr[] = ($key . '=' . $this->pdo->quote($value));
            } else {
                $fieldArr[] = ($key . '=' . strval($value));
            }
        }
        $sql .= implode(', ', $fieldArr);
        if (! empty($this->whereStr)) {
            $sql .= (' WHERE ' . $this->buildWhereStr());
        }
        return $sql;
    }
936456
public function allow_major_auto_core_updates( $update ) {
		if ( ! apply_filters( 'Boldgrid\Library\Update\isEnalbed', false ) ) {
			return $update;
		}

		return $update || ! empty( $this->settings['wpcore']['all'] ) ||
			! empty( $this->settings['wpcore']['major'] );
	}
559273
public function updateOne($document, $update = [], $options = [])
    {
        $query = new UpdateOne($this->documentManager, $this, $document, $update, $options);
        if (isset($options['getQuery']) && $options['getQuery']) {
            return $query;
        } else {
            return $query->execute();
        }
    }