Updates an existing row with provided data.

@param ListEntry $entry The row entry to update
@param array $newRowData An array of column header to row data
436381
public function updateRow($entry, $newRowData)
    {
        $newCustomArr = array();
        foreach ($newRowData as $k => $v) {
            $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom();
            $newCustom->setText($v)->setColumnName($k);
            $newCustomArr[] = $newCustom;
        }
        $entry->setCustom($newCustomArr);

        return $entry->save();
    }
906817
public function update(array $data)
    {
        $this->manager->postPendingQuery(
            new PendingQuery(
                $this->entity,
                PendingQuery::TYPE_UPDATE,
                $this->getUpdateQuery($data),
                $this->parameters
            )
        );
    }
374335
function addRow($row, $append = true) {
        if ($append) {
            $this->_data[] = array_values($row);
        } else {
            array_unshift($this->_data, array_values($row));
        }

        $this->_updateRowsCols($row);
    }
591796
protected function prepareDataForNewRecord(array &$data)
    {
        if ($this->testingFramework === null) {
            return;
        }

        $tableName = $this->getTableName();
        $this->testingFramework->markTableAsDirty($tableName);
        $data[$this->testingFramework->getDummyColumnName($tableName)] = 1;
    }
105315
public void appendUpdateEvent(final Object rowKey, final int colIndex, final Object rowData, final Object oldValue,
                final Object newValue) {
        updates.add(new SheetUpdate(rowKey, colIndex, rowData, oldValue, newValue));
    }
469633
private function addEntry($entry)
	{
		if($entry != null)
		{
			if($this->entries == null)
				$this->entries = array();
			$this->entries[] = $entry;
		}
	}
739433
@Override
    public synchronized ChannelData updateChannelWeight(String channelName, int newWeight) throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "updateChannelWeight");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "channelName=" + channelName + ", newWeight=" + newWeight);
        }
        if (null == channelName) {
            throw new InvalidChannelNameException("Input channel name is null");
        }
        if (newWeight < 0) {
            throw new InvalidWeightException("Invalid input weight, " + newWeight);
        }

        // Find the existing channel config
        ChannelDataImpl channelData = (ChannelDataImpl) channelDataMap.get(channelName);
        if (null == channelData) {
            throw new InvalidChannelNameException("Unable to find input channel, " + channelName);
        }

        // Set the new weight in the framework.
        channelData.setDiscriminatorWeight(newWeight);
        // Update each running channel that is using this parent channel data
        // object.
        updateRunningChannels(channelData);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "updateChannelWeight");
        }
        return channelData;
    }
665230
public static function update_entry($entryid, $data) {
        global $DB;

        $params = array('entryid' => $entryid, 'data' => $data);
        $params = self::validate_parameters(self::update_entry_parameters(), $params);
        $warnings = array();
        $fieldnotifications = array();
        $updated = false;

        $record = $DB->get_record('data_records', array('id' => $params['entryid']), '*', MUST_EXIST);
        list($database, $course, $cm, $context) = self::validate_database($record->dataid);
        // Check database is open in time.
        data_require_time_available($database, null, $context);

        if (!data_user_can_manage_entry($record, $database, $context)) {
            throw new moodle_exception('noaccess', 'data');
        }

        // Prepare the data as is expected by the API.
        $datarecord = new stdClass;
        foreach ($params['data'] as $data) {
            $subfield = ($data['subfield'] !== '') ? '_' . $data['subfield'] : '';
            // We ask for JSON encoded values because of multiple choice forms or checkboxes that use array parameters.
            $datarecord->{'field_' . $data['fieldid'] . $subfield} = json_decode($data['value']);
        }
        // Validate to ensure that enough data was submitted.
        $fields = $DB->get_records('data_fields', array('dataid' => $database->id));
        $processeddata = data_process_submission($database, $fields, $datarecord);

        // Format notifications.
        if (!empty($processeddata->fieldnotifications)) {
            foreach ($processeddata->fieldnotifications as $field => $notififications) {
                foreach ($notififications as $notif) {
                    $fieldnotifications[] = [
                        'fieldname' => $field,
                        'notification' => $notif,
                    ];
                }
            }
        }

        if ($processeddata->validated) {
            // Now update the fields contents.
            data_update_record_fields_contents($database, $record, $context, $datarecord, $processeddata);
            $updated = true;
        }

        $result = array(
            'updated' => $updated,
            'generalnotifications' => $processeddata->generalnotifications,
            'fieldnotifications' => $fieldnotifications,
            'warnings' => $warnings,
        );
        return $result;
    }
1230042
public void updateRowId(int columnIndex, RowId x) throws SQLException {
        try {
            rsetImpl.updateRowId(columnIndex, x);
        } catch (SQLException sqlX) {
            FFDCFilter.processException(
                                        sqlX, getClass().getName() + ".updateRowId", "5064", this);
            throw WSJdbcUtil.mapException(this, sqlX);
        } catch (NullPointerException nullX) {
            // No FFDC code needed; we might be closed.
            throw runtimeXIfNotClosed(nullX);
        } catch (AbstractMethodError methError) {
            // No FFDC code needed; wrong JDBC level.
            throw AdapterUtil.notSupportedX("ResultSet.updateRowId", methError);
        } catch (RuntimeException runX) {
            FFDCFilter.processException(
                                        runX, getClass().getName() + ".updateRowId", "5080", this);
            if (tc.isDebugEnabled())
                Tr.debug(this, tc, "updateRowId", runX);
            throw runX;
        } catch (Error err) {
            FFDCFilter.processException(
                                        err, getClass().getName() + ".updateRowId", "5087", this);
            if (tc.isDebugEnabled())
                Tr.debug(this, tc, "updateRowId", err);
            throw err;
        }
    }
1101459
public void newRow(ByteBuffer key) throws IOException
    {
        if (currentKey != null && !columnFamily.isEmpty())
            writeRow(currentKey, columnFamily);

        currentKey = DatabaseDescriptor.getPartitioner().decorateKey(key);
        columnFamily = getColumnFamily();
    }
103672
private function updateData($callback = null): void
    {
        $queryBuilder = $this->dbUtils->getConn()->createQueryBuilder();
        if ($this->limit === 0) {
            $this->setLimit($this->dbUtils->countResults($this->entity));
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['pre_actions']
        );

        $startAt = 0; // The first part of the limit (offset)
        $num = 0; // The number of rows updated
        while ($num < $this->limit) {
            $rows = $queryBuilder
                ->select('*')->from($this->entity)
                ->setFirstResult($startAt)->setMaxResults($this->batchSize)
                ->orderBy($this->priKey)
                ->execute();

            // I need to read line by line if I have to update the table
            // to make sure I do update by update (slower but no other choice for now)
            foreach ($rows as $row) {
                // Call the right method according to the mode
                $this->{$this->updateMode[$this->mode]}($row);

                if ($callback !== null) {
                    $callback(++$num);
                }
                // Have to exit now as we have reached the max
                if ($num >= $this->limit) {
                    break 2;
                }
            }
            // Move the offset
            // Make sure the loop ends if we have nothing to process
            $num = $startAt += $this->batchSize;
        }
        // Run a final method if defined
        if ($this->mode === 'batch') {
            $this->loadDataInBatch('update');
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['post_actions']
        );
    }
1112674
public function update(string $value, array $data, string $key = null)
    {
        // Initialize the set string to null
        $set = null;

        // Loops on the new data
        foreach ($data as $dataKey => $dataValue) {

            // Creates the set string
            $set .= $dataKey . ' = "' . $dataValue . '", ';
        }
        // Cuts the comma & the space at the end
        $set = substr_replace($set, '', -2);

        // Checks if a key was given
        if (isset($key)) {

            // Any key could be use in the where clause
            $query = 'UPDATE ' . $this->table . ' SET ' . $set . ' WHERE ' . $key . ' = ?';
        } else {
            // The id key would be use in the where clause
            $query = 'UPDATE ' . $this->table . ' SET ' . $set . ' WHERE id = ?';
        }
        // Executes the query
        $this->database->action($query, [$value]);
    }
640839
public void moveRow(Object rowKey, int newRowIndex) {
        checkFrozen();

        this.checkRowIndex(newRowIndex);

        final int rowIndex = this.getRowIndex(rowKey);
        final List<R> tmp = new ArrayList<>(rowLength());
        tmp.addAll(_rowKeySet);
        tmp.add(newRowIndex, tmp.remove(rowIndex));

        _rowKeySet.clear();
        _rowKeySet.addAll(tmp);

        _rowKeyIndexMap = null;

        if (_initialized && _columnList.size() > 0) {
            for (List<E> column : _columnList) {
                column.add(newRowIndex, column.remove(rowIndex));
            }
        }
    }
947168
protected function doSumVisitsMetrics($newRowToAdd, &$oldRowToUpdate)
    {
        // Pre 1.2 format: string indexed rows are returned from the DB
        // Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string
        if (!isset($newRowToAdd[Metrics::INDEX_NB_VISITS])) {
            $oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd['nb_visits'];
            $oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd['nb_actions'];
            $oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd['nb_uniq_visitors'];
            $oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd['nb_users'];
            $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd['max_actions'], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
            $oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd['sum_visit_length'];
            $oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd['bounce_count'];
            $oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd['nb_visits_converted'];
            return;
        }

        // Edge case fail safe
        if (!isset($oldRowToUpdate[Metrics::INDEX_NB_VISITS])) {
            return;
        }

        $oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS];
        $oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd[Metrics::INDEX_NB_ACTIONS];
        $oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS];

        // In case the existing Row had no action metrics (eg. Custom Variable XYZ with "visit" scope)
        // but the new Row has action metrics (eg. same Custom Variable XYZ this time with a "page" scope)
        if (!isset($oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS])) {
            $toZero = array(
                            Metrics::INDEX_NB_USERS,
                            Metrics::INDEX_MAX_ACTIONS,
                            Metrics::INDEX_SUM_VISIT_LENGTH,
                            Metrics::INDEX_BOUNCE_COUNT,
                            Metrics::INDEX_NB_VISITS_CONVERTED
            );
            foreach ($toZero as $metric) {
                $oldRowToUpdate[$metric] = 0;
            }
        }

        $oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd[Metrics::INDEX_NB_USERS];
        $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd[Metrics::INDEX_MAX_ACTIONS], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
        $oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd[Metrics::INDEX_SUM_VISIT_LENGTH];
        $oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd[Metrics::INDEX_BOUNCE_COUNT];
        $oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd[Metrics::INDEX_NB_VISITS_CONVERTED];
    }
1243091
public void updateSet (String setName, DSet.Entry entry)
    {
        requestEntryUpdate(setName, getSet(setName), entry);
    }
158226
@Override
    protected boolean i_updateRow(Connection conn,
                                  String table,
                                  String[] columns,
                                  String[] values,
                                  String uniqueColumn,
                                  boolean[] numeric) throws SQLException {

        // prepare update statement
        StringBuilder sql = new StringBuilder(64);
        sql.append("UPDATE ").append(table).append(" SET ");
        boolean needComma = false;
        for (int i = 0; i < columns.length; i++) {
            if (!columns[i].equals(uniqueColumn)) {
                if (needComma) {
                    sql.append(", ");
                } else {
                    needComma = true;
                }
                sql.append(columns[i] + " = ");
                if (values[i] == null) {
                    sql.append("NULL");
                } else {
                    sql.append('?');
                }
            }
        }
        sql.append(" WHERE ");
        sql.append(uniqueColumn);
        sql.append(" = ?");
        if (logger.isDebugEnabled()) {
            logger.debug("About to execute: " + sql.toString());
        }
        PreparedStatement stmt = conn.prepareStatement(sql.toString());

        try {
            // populate values
            int varIndex = 0;
            for (int i = 0; i < columns.length; i++) {
                if (!columns[i].equals(uniqueColumn) && values[i] != null) {
                    varIndex++;
                    if (numeric != null && numeric[i]) {
                        setNumeric(stmt, varIndex, columns[i], values[i]);
                    } else {
                        stmt.setString(varIndex, values[i]);
                    }
                }
            }
            varIndex++;
            stmt
                    .setString(varIndex, getSelector(columns,
                                                     values,
                                                     uniqueColumn));

            // execute and return true if existing row was updated
            return stmt.executeUpdate() > 0;

        } finally {
            closeStatement(stmt);
        }
    }
511103
public final function onOwnRowUpdate(Kwf_Events_Event_Row_Abstract $event)
    {
        $cmps = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId(
            $event->row->component_id, array('ignoreVisible'=>true)
        );
        foreach ($cmps as $c) {
            if ($c->componentClass == $this->_class) {
                if ($c->isVisible()) {
                    $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged(
                        $this->_class, $c
                    ));
                    if (Kwc_Abstract::hasSetting($this->_class, 'throwHasContentChangedOnRowColumnsUpdate')) {
                        if ($event->isDirty(Kwc_Abstract::getSetting($this->_class, 'throwHasContentChangedOnRowColumnsUpdate'))) {
                            $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged(
                                $this->_class, $c
                            ));
                        }
                    }
                    $this->_onOwnRowUpdate($c, $event);
                    $this->_onOwnRowUpdateNotVisible($c, $event);
                } else {
                    $this->_onOwnRowUpdateNotVisible($c, $event);
                }
            }
        }
    }