// update updates all IP addresses pending update in the database, clearing pending updates.
// No-op unless computeChanges was called first. Idempotent until computeChanges is called again.
192430
func (t *IPsTable) update(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.updates) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		UPDATE ips
		SET vlan_id = ?
		WHERE id = ?
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Update each IP address in the table. It's more efficient to update the slice of
	// IP addresses once at the end rather than for each update, so use a defer.
	updated := make(map[int64]*IP, len(t.updates))
	defer func() {
		for _, ip := range t.current {
			if u, ok := updated[ip.Id]; ok {
				ip.VLANId = u.VLANId
			}
		}
	}()
	for len(t.updates) > 0 {
		ip := t.updates[0]
		if _, err := stmt.ExecContext(c, ip.VLANId, ip.Id); err != nil {
			return errors.Annotate(err, "failed to update IP address %q", ip.IPv4).Err()
		}
		updated[ip.Id] = ip
		t.updates = t.updates[1:]
		logging.Infof(c, "Updated IP address %q", ip.IPv4)
	}
	return nil
}
1084843
func (db *sqlDB) Update(m Model, id string, s interface{}) error {
	stmt, err := db.stmts.Stmt(m)
	if err != nil {
		return err
	}

	return db.editRecord(s, stmt.Update, id)
}
499027
func (u *Updater) Update(ctx Context) (*Update, error) {
	options := ctx.UpdateOptions()
	update, err := u.update(ctx, options)
	report(ctx, err, update, options)
	return update, err
}
328297
func (s *session) update(table Table, insert bool, fields ...string) (string, error) {
	// database op
	if insert {
		_, err := s.database.Insert(table)
		if err != nil {
			return action_db_insert, err
		}
	} else {
		if len(fields) == 0 {
			fields = table.TableMeta().Fields()
		}
		_, err := s.database.Update(table, fields...)
		if err != nil {
			return action_db_update, err
		}
	}

	// cache op
	if s.cache == nil {
		return action_null, nil
	}
	return s.updateCache(table, fields...)
}
847847
func (a *accounter) Update() {
	c := atomic.LoadInt64(&a.current)
	if c != a.currentValue {
		a.write(c)
		a.currentValue = c
	}
}
870578
func (_m *Client) Update(uid string, pu groveclient.PostUpdate, options groveclient.UpdateOptions) (*groveclient.PostItem, error) {
	ret := _m.Called(uid, pu, options)

	var r0 *groveclient.PostItem
	if rf, ok := ret.Get(0).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) *groveclient.PostItem); ok {
		r0 = rf(uid, pu, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*groveclient.PostItem)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) error); ok {
		r1 = rf(uid, pu, options)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1018822
func (a *AddressOutpoints) Update(txns []*TxWithBlockData,
	outpoints []*wire.OutPoint, prevOutpoint []PrevOut) {
	// Relevant outpoints
	a.Outpoints = append(a.Outpoints, outpoints...)

	// Previous outpoints (inputs)
	a.PrevOuts = append(a.PrevOuts, prevOutpoint...)

	// Referenced transactions
	for _, t := range txns {
		a.TxnsStore[t.Hash()] = t
	}
}
1297327
func (si *SolrInterface) Update(data interface{}, params *url.Values) (*SolrUpdateResponse, error) {
	if si.conn == nil {
		return nil, fmt.Errorf("No connection found for making request to solr")
	}
	return si.conn.Update(data, params)
}
449974
func (repo *repo) Update(user service.Entity) error {
	return dbconn.DB.Save(&user).Error
}
35949
func (r *AppService) Update(id string, appupdatereq *AppUpdateReq) *AppUpdateCall {
	c := &AppUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.id = id
	c.appupdatereq = appupdatereq
	return c
}
1132481
func (b *bgpManager) update() {
	ncc := b.engine.ncc
	if err := ncc.Dial(); err != nil {
		log.Warningf("BGP manager failed to connect to NCC: %v", err)
		return
	}
	defer ncc.Close()

	neighbors, err := ncc.BGPNeighbors()
	if err != nil {
		log.Warningf("Failed to get BGP neighbors: %v", err)
		return
	}
	b.lock.Lock()
	b.neighbors = neighbors
	b.lock.Unlock()
}
234235
func Update(i interface{}) error {
	if !isPtr(i) {
		return NoPtr
	}

	err := addCurrentDateTime(i, "UpdatedAt")
	if err != nil {
		return err
	}

	s, err := GetSession()
	if err != nil {
		return err
	}
	defer s.Close()

	id, err := getObjIdFromStruct(i)
	if err != nil {
		return err
	}

	return GetColl(s, typeName(i)).Update(bson.M{"_id": id}, i)
}
761601
func (pl *List) Update(updates peer.ListUpdates) error {
	ctx, cancel := context.WithTimeout(context.Background(), pl.startupWait)
	defer cancel()
	if err := pl.once.WaitUntilRunning(ctx); err != nil {
		return intyarpcerrors.AnnotateWithInfo(yarpcerrors.FromError(err), "%s peer list is not running", "peer heap")
	}

	var errs error

	pl.mu.Lock()
	defer pl.mu.Unlock()

	for _, pid := range updates.Removals {
		errs = multierr.Append(errs, pl.releasePeer(pid))
	}

	for _, pid := range updates.Additions {
		errs = multierr.Append(errs, pl.retainPeer(pid))
	}

	return errs
}
1126334
func (vrsConnection VRSConnection) Update(context interface{}, tableUpdates libovsdb.TableUpdates) {
	vrsConnection.updatesChan <- &tableUpdates
}
247939
func (s *ProbesService) Update(k ProbeKey, dp ProbeInfoDTO) (*http.Response, error) {
	return s.client.put(k.URI(), dp, nil)
}
853003
func (db *Database) Updates(value DBModel) error {
	defer func() {
		if db.rawRows != nil {
			db.rawRows.Close()
		}
	}()
	// Build where condition for update
	clone := db.Where(value)
	return clone.commonCreateUpdate(value, clone.buildUpdate)
}
855775
func (self *Record) Update(args RecordUpdate) ([]*RecordInfo, error) {
	var res []interface{}
	updateArgs := map[string]interface{}{
		"name":  args.Name,
		"type":  args.Type,
		"value": args.Value,
		"ttl":   args.Ttl,
	}
	updateOpts := map[string]string{
		"id": args.Id,
	}

	params := []interface{}{self.Key, args.Zone, args.Version, updateOpts, updateArgs}
	if err := self.Call("domain.zone.record.update", params, &res); err != nil {
		return nil, err
	}

	records := make([]*RecordInfo, 0)
	for _, r := range res {
		record := ToRecordInfo(r.(map[string]interface{}))
		records = append(records, record)
	}
	return records, nil
}