Take the extracted array and build an update query

@param array $extracted

@return string
324723
private function convertExtractedToSqlRow(array $extracted): string
    {
        if ([] === $extracted) {
            throw new \RuntimeException('Extracted array is empty in ' . __METHOD__);
        }
        $primaryKeyCol = null;
        $primaryKey    = null;
        $sql           = "update `{$this->tableName}` set ";
        $sqls          = [];
        foreach ($extracted as $key => $value) {
            if (null === $primaryKeyCol) {
                $primaryKeyCol = $key;
                $primaryKey    = $this->convertUuidToSqlString($value);
                continue;
            }
            $value  = $this->mysqli->escape_string((string)$value);
            $sqls[] = "`$key` = '$value'";
        }
        $sql .= implode(",\n", $sqls);
        $sql .= " where `$primaryKeyCol` = $primaryKey; ";

        return $sql;
    }
1373627
public function backupData(array $excluded=[]): string
	{
		// Get a list of all the objects
		$sql = 'SELECT DISTINCT "name"
				FROM "sqlite_master"
				WHERE "type"=\'table\'';

		if( ! empty($excluded))
		{
			$sql .= " AND \"name\" NOT IN('".implode("','", $excluded)."')";
		}

		$res = $this->getDriver()->query($sql);
		$result = $res->fetchAll(PDO::FETCH_ASSOC);

		unset($res);

		$outputSql = '';

		// Get the data for each object
		foreach($result as $r)
		{
			$sql = 'SELECT * FROM "'.$r['name'].'"';
			$res = $this->getDriver()->query($sql);
			$objRes = $res->fetchAll(PDO::FETCH_ASSOC);

			unset($res);

			// If the row is empty, continue;
			if (empty($objRes))
			{
				continue;
			}

			// Nab the column names by getting the keys of the first row
			$columns = array_keys(current($objRes));

			$insertRows = [];

			// Create the insert statements
			foreach($objRes as $row)
			{
				$row = array_values($row);

				// Quote values as needed by type
				for($i=0, $icount=count($row); $i<$icount; $i++)
				{
					$row[$i] = (is_numeric($row[$i])) ? $row[$i] : $this->getDriver()->quote($row[$i]);
				}

				$rowString = 'INSERT INTO "'.$r['name'].'" ("'.implode('","', $columns).'") VALUES ('.implode(',', $row).');';

				unset($row);

				$insertRows[] = $rowString;
			}

			unset($objRes);

			$outputSql .= "\n\n".implode("\n", $insertRows);
		}

		return $outputSql;
	}
1169807
public function update(array $data) {
        $sql = $this->grammar()->compileUpdate($this, $data);
        return $this->command()
            ->update($sql, $this->getBindings());
    }
96243
public function update(string $table): Query\Update
    {
        $query = new Query\Update();
        $query->update($table);
        return $query;
    }
905161
public static function update($table,$where=[],$data)
    {
        if(empty($data)) throw new Exception("DB update data is null");
        
        $column='';
        $bind=[];
        $ends=count($data)-1;
        $n=0;
        foreach ($data as $key=>$value) {
            $column.="`{$key}`=:{$key}";
            $bind[$key]=$value;
            if($n!=$ends){
                $column.=',';
            }
            $n++;
        }
        if(empty($where)){
            $where='';
        }else{
            $w=new Where($where);
            $where=' WHERE '.$w->parseWhere();
            $bind=array_merge($bind,$w->parseBind());
        }
        $sql=sprintf('UPDATE `:%s` SET %s %s',$table,$column,$where);
        $bind=array_merge($bind,$bind);
        return self::execute($sql,$bind);
    }
490567
private function extract(iterable $extractors, string $method, array $arguments)
    {
        foreach ($extractors as $extractor) {
            if (null !== $value = $extractor->{$method}(...$arguments)) {
                return $value;
            }
        }
    }
910403
public function update($dataOrModel, array $where, $tableName = null, HydratorInterface $hydrator = null)
    {
        $tableName = $tableName ?: $this->getTableName();
        $data = $this->extract($dataOrModel, $hydrator);
        if ($tableName === $this->getTableName()) {
            $data = $this->cleanData($data);
        }

        $sql = $this->getSql();
        $update = $sql->update($tableName);

        $update->set($data)
            ->where($where);

        $statement = $sql->prepareStatementForSqlObject($update);

        return $statement->execute();
    }
142788
public function compile_update( &$query )
	{
		$build = 'update '.$this->escape_table( $query ).' set ';

		// add the array values.
		foreach( $query->values as $key => $value )
		{
			$build .= $this->escape( $key ).' = '.$this->param( $value ).', ';
		}

		$build = substr( $build, 0, -2 );
		$build .= $this->compile_where( $query );
		$build .= $this->compile_limit( $query );

		// cut the last comma away
		return $build;
	}
273015
public function update(array $values): array
	{
		$sql  = $this->query->getPrefix();
		$sql .= 'UPDATE ';
		$sql .= $this->escapeTable($this->query->getTable());
		$sql .= ' SET ';
		$sql .= $this->updateColumns($values);
		$sql .= $this->wheres($this->query->getWheres());

		return ['sql' => $sql, 'params' => $this->params];
	}
163898
public function getUpdateSQL($table, $data, $where, $values, $order, $limit) {
        $len = count($table);
        if ($len == 1) {
            $sql = ['UPDATE', implode(' AS ', $table[0]), 'SET'];
        } else {
            $tables = [];
            foreach ($table as $t) {
                $tables[] = implode(' AS ', $t);
            }
            $sql = ['UPDATE', implode(' , ', $tables), 'SET'];
        }

        $fields = [];
        foreach ($data as $field => $value) {
            $field = Condition::cleanField($field);
            if ($value instanceof Query) {
                $value->setBindValues($values);
                $value->setDialect($this);
                $fields [] = $this->sanitize($field) . ' =  (' . $value->__toString() . ')';
            } else if ($value instanceof ImmutableValue) {
                $value->setDialect($this);
                $fields [] = $this->sanitize($field) . ' =  ' . $this->sanitize($value->__toString());
            } else {
                $fields [] = $this->sanitize($field) . ' = ' . $values->addValue($field, $value);
            }
        }

        $sql [] = implode(' , ', $fields);
        if ($where && count($where) > 0) {
            $sql [] = 'WHERE';
            $sql [] = $where->getWhereCondition($this, $values);
        }

        if ($len == 1) {
            if ($order) {
                $_orders = [];
                foreach ($order as $o) {
                    $_orders [] = Condition::cleanField($o [0]) . ' ' . ($o [1] == 'a' ? 'ASC' : 'DESC');
                }
                $sql [] = 'ORDER BY ' . implode(' , ', $_orders);
            }
            if ($limit) {
                $limit2 = $values->addValue('limit', $limit [1]);
                $sql [] = 'LIMIT ' . $limit2;
            }
        }

        return implode(' ', $sql);
    }
712252
public function newQuery($excludeDeleted = true)
	{
		$builder = $this->newActiveRecordBuilder($this->newBaseQueryBuilder());

		// Once we have the query builders, we will set the model instances so the
		// builder can easily access any information it may need from the model
		// while it is constructing and executing various queries against it.
		$builder->setModel($this)->with($this->with);

		if ($excludeDeleted && $this->softDelete)
		{
			$builder->whereNull($this->getQualifiedDeletedAtColumn());
		}

		return $builder;
	}
563249
public function update($query, array $options = []) {
		$this->_checkConnection();

		$defaults = [
			'upsert' => false,
			'multiple' => true,
			'w' => $this->_config['w'],
			'wTimeoutMS' => $this->_config['wTimeoutMS'],
			'fsync' => false
		];
		$options += $defaults;

		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$exporter = $this->_classes['exporter'];
			$prefix = $this->_config['gridPrefix'];

			$options = $params['options'];
			$query  = $params['query'];
			$args   = $query->export($this, ['keys' => ['conditions', 'source', 'data']]);
			$source = $args['source'];
			$data   = $args['data'];

			if ($query->entity()) {
				$data = $exporter::get('update', $data);
			}

			if ($source === "{$prefix}.files" && isset($data['update']['file'])) {
				$args['data']['_id'] = $this->_saveFile($data['update']);
			}
			$update = $query->entity() ? $exporter::toCommand($data) : $data;

			if (empty($update)) {
				return true;
			}
			if ($options['multiple'] && !preg_grep('/^\$/', array_keys($update))) {
				$update = ['$set' => $update];
			}
			$result = $this->connection->{$source}->update($args['conditions'], $update, $options);

			if ($this->_ok($result)) {
				$query->entity() ? $query->entity()->sync() : null;
				return true;
			}
			return false;
		});
	}
1160547
public function applyExtract(IExtractStrategy $extract)
    {
        /* @var $document \TextAnalysis\Documents\TokensDocument */
        $found = [];
        foreach($this->documents as $document)
        {
            $found = array_merge($document->applyExtract($extract), $found);
        }
        return $found;
    }
938141
public function update(SQLStatement $update): string
    {
        $joins = $this->handleJoins($update->getJoins());
        $tables = $update->getTables();

        if ($joins !== '') {
            $joins = ' FROM ' . $this->handleTables($tables) . ' ' . $joins;
            $tables = array_values($tables);
        }

        $sql = 'UPDATE ';
        $sql .= $this->handleTables($tables);
        $sql .= $this->handleSetColumns($update->getColumns());
        $sql .= $joins;
        $sql .= $this->handleWheres($update->getWheres());

        return $sql;
    }
1260935
public function extractTo($destination, $entities = null)
    {
        if ($entities) {
            return $this->zipArchive->extractTo($destination, $entities);
        } else {
            return $this->zipArchive->extractTo($destination);
        }
    }
312314
private function genUpdate(array $data, array $where): string
    {
        // Current table
        $table = $this->getCollection();

        // Generate line with data for update
        $fieldDetails = !empty($data)
            ? $this->genFields($data)
            : '';

        // Generate where line
        $whereDetails = !empty($where)
            ? ' WHERE ' . $this->genWhere($where)
            : '';

        return "UPDATE $table SET $fieldDetails $whereDetails";
    }
1305498
public function update($query, array $data) {
        $stmt = $this->executeQuery($query, $data);

        return $stmt->rowCount();       
    }