Performs the database update

@param array &$databaseQueries Queries done in this update
@param string &$customMessage Custom message
@return bool
769400
public function performUpdate(array &$databaseQueries, &$customMessage)
    {
        $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('sys_template');

        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_template');
        $queryBuilder->getRestrictions()->removeAll();
        $records = $queryBuilder
            ->select('uid', 'include_static_file', 'constants', 'config')
            ->from('sys_template')
            ->where(
                $queryBuilder->expr()->orX(
                    $queryBuilder->expr()->like(
                        'constants',
                        $queryBuilder->createNamedParameter('%' . $this->oldLocation . '%', \PDO::PARAM_STR)
                    ),
                    $queryBuilder->expr()->like(
                        'config',
                        $queryBuilder->createNamedParameter('%' . $this->oldLocation . '%', \PDO::PARAM_STR)
                    ),
                    $queryBuilder->expr()->like(
                        'include_static_file',
                        $queryBuilder->createNamedParameter('%' . $this->oldLocation . '%', \PDO::PARAM_STR)
                    )
                )
            )
            ->execute()
            ->fetchAll();

        $listOfUpdateIds = [];
        foreach ($records as $record) {
            $queryBuilder = $connection->createQueryBuilder();
            $queryBuilder->update('sys_template')
                ->where(
                    $queryBuilder->expr()->eq(
                        'uid',
                        $queryBuilder->createNamedParameter($record['uid'], \PDO::PARAM_INT)
                    )
                )
                ->set('include_static_file', str_replace($this->oldLocation, $this->newLocation, $record['include_static_file']))
                ->set('constants', str_replace($this->oldLocation, $this->newLocation, $record['constants']))
                ->set('config', str_replace($this->oldLocation, $this->newLocation, $record['config']));
            $queryBuilder->execute();
            $listOfUpdateIds[] = $record['uid'];
        }
        $customMessage = 'Updated sys_templates with UID: ' . implode(', ', $listOfUpdateIds);
        $this->markWizardAsDone();
        return true;
    }
409406
protected function performUpdate(QueryBuilder $query)
    {
        // Dosparar evento de documento sendo alterado
        if ($this->fireModelEvent('updating') === false) {
            return false;
        }

        // Verificar para atualizar os timestamps
        if ($this->usesTimestamps()) {
            $this->updateTimestamps();
        }

        // Carregar lista só dos atributos que foram alterados
        $changes = $this->getChanged();

        if (count($changes) > 0) {
            $query->where('_id', $this->getId());
            $query->update($changes);

            // Disparar evento de documento alterado
            $this->fireModelEvent('updated', false);
        }

        return true;
    }
602007
public function update($sql, $parameters = array()) {
        DB::addQueryLog($sql, $parameters);
        return $this->getEngine()->update($sql, $parameters);
    }
1250141
protected int doUpdate(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) {
        //Setup the update parameters and setter
        final List<Phrase> parametersInUse = update_parameters != null ? update_parameters : parameters;
        final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res);
        
        //Get the update sql and execute the update.
        final String fUpdateSql = (String) update_sql.evaluate(req, res);
        return jdbcTemplate.update(fUpdateSql, preparedStatementSetter);
    }
773140
public function saveMessagesToDb($messages, $db, $sourceMessageTable, $messageTable, $removeUnused, $languages)
    {
        $q = new \yii\db\Query;
        $current = [];

        foreach ($q->select(['id', 'category', 'message'])->from($sourceMessageTable)->all() as $row) {
            $current[$row['category']][$row['id']] = $row['message'];
        }

        $new = [];
        $obsolete = [];

        foreach ($messages as $category => $msgs) {
            $msgs = array_unique($msgs);

            if (isset($current[$category])) {
                $new[$category] = array_diff($msgs, $current[$category]);
                $obsolete += array_diff($current[$category], $msgs);
            } else {
                $new[$category] = $msgs;
            }
        }

        foreach (array_diff(array_keys($current), array_keys($messages)) as $category) {
            $obsolete += $current[$category];
        }

        if (!$removeUnused) {
            foreach ($obsolete as $pk => $m) {
                if (mb_substr($m, 0, 2) === '@@' && mb_substr($m, -2) === '@@') {
                    unset($obsolete[$pk]);
                }
            }
        }

        $obsolete = array_keys($obsolete);
        $this->stdout("Inserting new messages...");
        $savedFlag = false;
        $columnNames = $db->getTableSchema($sourceMessageTable)->columnNames;
        $hasLocationColumn = in_array('location', $columnNames) ?: false;

        foreach ($new as $category => $msgs) {
            foreach ($msgs as $m) {
                $savedFlag  = true;
                $msgHash    = md5($m);
                $sourceMessageData = [
                    'category'  => $category,
                    'message'   => $m,
                ];
                if ( true === $hasLocationColumn ) {
                    $sourceMessageData['location']  = $this->extractLocations($category, $m);
                    $sourceMessageData['hash']      = $msgHash;
                }
                $db->createCommand()
                    ->insert($sourceMessageTable, $sourceMessageData)
                    ->execute()
                ;
                $lastID = ($db->driverName == 'pgsql')
                        ? $db->getLastInsertID($sourceMessageTable . '_id_seq')
                        : $db->getLastInsertID();
                foreach ($languages as $language) {
                    $messageData = [
                        'id'        => $lastID,
                        'language'  => $language,
                    ];
                    if ( true === $hasLocationColumn ) {
                        $messageData['hash'] = $msgHash;
                    }
                    $db->createCommand()
                        ->insert($messageTable, $messageData)
                        ->execute()
                    ;
                }
            }
        }

        $this->stdout($savedFlag ? "saved." . PHP_EOL : "Nothing new...skipped." . PHP_EOL);
        $this->stdout($removeUnused ? "Deleting obsoleted messages..." . PHP_EOL : "Updating obsoleted messages..." . PHP_EOL);

        if (empty($obsolete)) {
            $this->stdout("Nothing obsoleted!...skipped." . PHP_EOL);
        } else {
            if ($removeUnused) {
                $db->createCommand()
                   ->delete($sourceMessageTable, ['in', 'id', $obsolete])->execute();
                $this->stdout("deleted." . PHP_EOL);
            } else {
                $db->createCommand()
                    ->update(
                        $sourceMessageTable,
                        ['message' => new \yii\db\Expression("CONCAT('@@',message,'@@')")],
                        ['in', 'id', $obsolete]
                    )
                    ->execute()
                ;
                $this->stdout("updated." . PHP_EOL);
            }
        }

        // ------------------------------ COUNTER ------------------------------
        $counter = ['new' => 0, 'obsolete' => count($obsolete)];
        foreach ( $new as $msgs ) {
            $counter['new'] += count($msgs);
        }

        return $counter;
    }
179038
public function query(string $query_string, array $params = [], array $options = []) : DAO
    {
        // Reset in case a previous query was attempted.
        $this->query_succeeded = false;

        // Connect to the database
        if (!$this->is_connected) {
            $this->connect();
        }

        try {
            $stmt = $this->getStatement($query_string);
            $this->stmt = $stmt;
            $stmt->execute($params);
        } catch (DatabaseQueryException $e) {
            throw $e;
        } catch (\Exception $e) {
            throw new DatabaseQueryException($e->getMessage() . '|| QUERY: ' . $query_string);
        }

        $this->query_succeeded = $this->stmt->querySucceeded();

        return $this;
    }
957220
public function update($infos)
    {
        $tabela        = $infos['table'];
        $campos        = $infos['fields'];
        $camposV       = $infos['values'];
        $whereCriteria = $infos['where'];

        try {
            $camposNome = [];
            for ($i = 0; $i < count($campos); $i++) {
                if ($camposV[$i] != null) {
                    $camposNome[$i] = $campos[$i];
                }
            }

            $camposNome = array_values($camposNome);
            $this->sql = "UPDATE $tabela SET ";

            for ($i = 0; $i < count($camposNome); $i++) {
                if (!empty($camposNome[$i])) {
                    if ($i != count($camposNome) - 1) {
                        $this->sql .= $camposNome[$i] . " = :" . $camposNome[$i] . ", ";
                    } else {
                        $this->sql .= $camposNome[$i] . " = :" . $camposNome[$i];
                    }
                }
            }

            if (!empty($whereCriteria)) {
                $this->sql .= " WHERE " . $whereCriteria . " ";
            }

            return $this->sql . ";";

        } catch (PhiberException $e) {
            throw new PhiberException(new Internationalization("query_processor_error"));
        }
    }
226221
public function query(string $sql, array $params = []) {
        X::logger()->trace("$sql with params " . $this->serializeArray($params));
        try {
            $st = $this->pdo->prepare($sql);
            if ($st === false) {
                $e = $this->pdo->errorInfo();
                throw new DataBaseException($e[2], $e[1]);
            }
            if ($st->execute($params)) {
                $this->_affectedRows = $st->rowCount();
                $this->_lastInsertId = $this->pdo->lastInsertId();
                return $st->fetchAll(PDO::FETCH_ASSOC);
            }

            $e = $st->errorInfo();
            throw new DataBaseException($e[2], $e[1]);
        } catch (PDOException $ex) {
            X::logger()->trace($ex);
            throw new DataBaseException($ex->getMessage(), $ex->getCode());
        }
    }
1241895
def update(self, **kwargs) -> "UpdateQuery":
        
        return UpdateQuery(
            db=self._db,
            model=self.model,
            update_kwargs=kwargs,
            q_objects=self._q_objects,
            annotations=self._annotations,
            custom_filters=self._custom_filters,
        )
738505
private function doInsertByQueries(): void
    {
        $data = $this->generateFakeData();

        $queryBuilder = $this->dbUtils->getConn()->createQueryBuilder();
        $queryBuilder = $queryBuilder->insert($this->entity);
        foreach ($data as $field => $value) {
            $queryBuilder = $queryBuilder->setValue($field, ":$field");
            $queryBuilder = $queryBuilder->setParameter(":$field", $value);
        }

        $this->returnRes === true ?
            array_push($this->queries, $this->dbUtils->getRawSQL($queryBuilder)) :
            null;

        if ($this->pretend === false) {
            $queryBuilder->execute();
        }
    }
632643
private function processUpdate()
    {
        if (! isset($this->definition['fields']) && ! isset($this->definition['field'])) {
            Throw new QueryBuilderException('QueryBuilder need a "field" or "fields" list element to process "UPDATE" definition.');
        }
        if (! isset($this->definition['params'])) {
            Throw new QueryBuilderException('QueryBuilder need a assoc array param list to process "UPDATE" definition.');
        }
        
        $this->processFieldDefinition();
        $this->processFilterDefinition();
        $this->processParamsDefinition();
        $this->processLimitDefinition();
        $this->processOrderDefinition();
    }
953617
protected function getCustomMessage($key, $ruleName, array $customMessages)
    {

        // First check for custom messages with key
        if (isset($customMessages["$key.$ruleName"])) {
            return $customMessages["$key.$ruleName"];
        }

        // Then check for custom messages without key
        if (isset($customMessages[$ruleName])) {
            return $customMessages[$ruleName];
        }

        // Then check for custom translator messages
        $customTranslationKey = "custom.$key.$ruleName";

        if ($this->textProvider->has($customTranslationKey)) {
            return $this->textProvider->get($customTranslationKey);
        }

        return '';

    }
1176653
public static function ExecuteAll($executeQueries)
	{
		$db = self::connect();
	
		$db->beginTransaction();
		$rowsAffected = 0;
		
		try
		{
			foreach($executeQueries as $executeQuery)
			{
				$query = $db->prepare($executeQuery["statement"]);
			
				foreach($executeQuery["parameters"] as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
						
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
					
				$query->execute();
				$rowsAffected += $query->rowCount();	
			}
		}
		catch (PDOException $e)
		{
			$db->rollBack();
			$exception = "Sorry, there was a problem with query execution. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		$db->commit();
		return $rowsAffected;
	}
105275
public function executeUpdate()
	{
		
		try {

			$result = $this->connection->execute($this->query_string);

			if ($result === false) throw new MySQLException(get_class(new MySQLException)." There was an error in the query: {$this->connection->lastError()} <span class=\"query-string\">".$this->query_string."</span>");

			return true;
				
		}
		 catch (MySQLException $e) {
			
			$e->errorShow();	
		}	
	}
1045626
public ResultSet runSelect(String logMessage, String query, Object[] arguments) throws SQLException {
        long before = System.currentTimeMillis();
        try {
            return runSelect(query, arguments);
        }
        finally {
            if (logger.isDebugEnabled()) {
                long after = System.currentTimeMillis();
                logger.debug(logMessage + " (" + (after - before) + " ms): " + DbAccess.substitute(query, arguments));
            }
        }
    }
917795
public function update()
    {
        $conditions = $this->infosMergeds['fields_and_values'];

        $this->sql = new PhiberQueryWriter("update", [
            "table"  => $this->table,
            "fields" => $this->fields,
            "values" => $this->fieldsValues,
            "where"  => isset($this->infosMergeds['where']) ?
                $this->infosMergeds['where'] :
                null,
            "limit"  => isset($this->infosMergeds['limit']) ?
                $this->infosMergeds['limit'] :
                null,
            "offset"  => isset($this->infosMergeds['offset']) ?
                $this->infosMergeds['offset'] :
                null
        ]);

        if ($this->phiberConfig->verifyExecuteQueries()) {

            $this->PDO = $this->PDO->prepare($this->sql);
            for ($i = 0; $i < count($this->fields); $i++) {
                if (!empty($this->fieldsValues[$i])) {
                    $this->PDO->bindValue($this->fields[$i], $this->fieldsValues[$i]);
                }
            }

            while (current($conditions)) {
                $this->PDO->bindValue(
                    "condition_" . key($conditions), 
                    $conditions[key($conditions)]
                );
                
                next($conditions);
            }

            if ($this->PDO->execute()) {
                return true;
            }
        }

        return false;
    }
873995
public function update(CustomCollection &$customCollection)
    {
        $data = $customCollection->exportData();
        $endpoint = '/admin/custom_collections/'.$customCollection->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'custom_collection' => $data
            )
        );
        $customCollection->setData($response['custom_collection']);
    }