Updates flow objects in the database.
325551
def UpdateFlows(self,
                  client_id_flow_id_pairs,
                  pending_termination=db.Database.unchanged,
                  cursor=None):
    """"""

    if pending_termination == db.Database.unchanged:
      return

    serialized_termination = pending_termination.SerializeToString()
    query = "UPDATE flows SET pending_termination=%s WHERE "
    args = [serialized_termination]
    for index, (client_id, flow_id) in enumerate(client_id_flow_id_pairs):
      query += ("" if index == 0 else " OR ") + " client_id=%s AND flow_id=%s"
      args.extend(
          [db_utils.ClientIDToInt(client_id),
           db_utils.FlowIDToInt(flow_id)])
    cursor.execute(query, args)
536317
public void applyUpdates(DBTransaction dbTran) {
        // Column adds
        for (String storeName : m_columnAdds.keySet()) {
            Map<String, Map<String, byte[]>> rowMap = m_columnAdds.get(storeName);
            for (String rowKey : rowMap.keySet()) {
                Map<String, byte[]> colMap = rowMap.get(rowKey);
                for (String colName : colMap.keySet()) {
                    byte[] colValue = colMap.get(colName);
                    if (colValue == null) {
                        dbTran.addColumn(storeName, rowKey, colName);
                    } else {
                        dbTran.addColumn(storeName, rowKey, colName, colValue);
                    }
                }
            }
        }
        
        // Column deletes
        for (String storeName : m_columnDeletes.keySet()) {
            Map<String, List<String>> rowMap = m_columnDeletes.get(storeName);
            for (String rowKey : rowMap.keySet()) {
                dbTran.deleteColumns(storeName, rowKey, rowMap.get(rowKey));
            }
        }
        
        // Row deletes
        for (String storeName : m_rowDeletes.keySet()) {
            for (String rowKey : m_rowDeletes.get(storeName)) {
                dbTran.deleteRow(storeName, rowKey);
            }
        }
    }
1280246
private void applyUpdates(DBTransaction dbTran) {
        Map<String, Map<String, List<DColumn>>> colUpdatesMap = dbTran.getColumnUpdatesMap();
        for (String storeName : colUpdatesMap.keySet()) {
            updateTableColumnUpdates(storeName, colUpdatesMap.get(storeName));
        }
        
        Map<String, Map<String, List<String>>> colDeletesMap = dbTran.getColumnDeletesMap();
        for (String storeName : colDeletesMap.keySet()) {
            updateTableColumnDeletes(storeName, colDeletesMap.get(storeName));
        }
        
        Map<String, List<String>> rowDeletesMap = dbTran.getRowDeletesMap();
        for (String storeName : rowDeletesMap.keySet()) {
            for (String rowKey : rowDeletesMap.get(storeName)) {
                Map<String, AttributeValue> key = DynamoDBService.makeDDBKey(rowKey);
                m_service.deleteRow(storeName, key);
            }
        }
    }
994623
public function updateAllAction() {
        QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0');
        ModelOperator::getInstance(DC::getEnvironment()->getUserClassesRoot().'db/')->updateDBForAllModels();
        ModelOperator::getInstance()->generateAllModelClasses();
        $this->writeln('DB updated');
    }
244894
def update(self, f):
        """"""

        for p in self.__mapper__.attrs:

            if p.key == 'oid':
                continue
            try:
                setattr(self, p.key, getattr(f, p.key))

            except AttributeError:
                # The dict() method copies data property values into the main dict,
                # and these don't have associated class properties.
                continue
1064325
public void update() {

        switch (shapeType) {

            case POLYLINE_MARKERS:
                ((PolylineMarkers) shape).update();
                break;
            case POLYGON_MARKERS:
                ((PolygonMarkers) shape).update();
                break;
            case MULTI_POLYLINE_MARKERS:
                ((MultiPolylineMarkers) shape).update();
                break;
            case MULTI_POLYGON_MARKERS:
                ((MultiPolygonMarkers) shape).update();
                break;
            case COLLECTION:
                @SuppressWarnings("unchecked")
                List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape;
                for (GoogleMapShape shapeListItem : shapeList) {
                    shapeListItem.update();
                }
                break;
            default:
        }

    }
888297
async def update(self, db=None, data=None):
        '''
        
        '''
        db = db or self.db
        if data:  # update model explicitely with a new data structure
            # merge the current model's data with the new data
            self.import_data(data)
            # prepare data for database update
            data = self.prepare_data()
            # data = {x: ndata[x] for x in ndata if x in data or x == self.primary_key}
        else:
            data = self.export_data(native=True)

        if self.primary_key not in data or data[self.primary_key] is None:
            raise Exception('Missing object primary key')
        query = {self.primary_key: self.pk}
        for i in self.connection_retries():
            try:
                result = await db[self.get_collection_name()].find_one_and_replace(
                    filter=query,
                    replacement=data,
                    return_document=ReturnDocument.AFTER
                )
                if result:
                    updated_obj = self.create_model(result)
                    updated_obj._db = db
                    # emit post save
                    asyncio.ensure_future(post_save.send(
                        sender=self.__class__,
                        db=db,
                        instance=updated_obj,
                        created=False)
                    )
                    return updated_obj

                return None
            except ConnectionFailure as ex:
                exceed = await self.check_reconnect_tries_and_wait(i, 'update')
                if exceed:
                    raise ex
174438
def database_forwards(self, app_label, schema_editor, from_state, to_state):
        """"""
        Process = from_state.apps.get_model('flow', 'Process')  # pylint: disable=invalid-name

        # Validate process types to ensure consistency.
        errors = validate_process_types(Process.objects.all())
        if errors:
            raise ValueError("Process type consistency check failed after migration: {}".format(errors))
543053
def _update_related(self, obj, related, subfield_dict):
        
        # keep track of whether or not anything was updated
        updated = False

        # for each related field - check if there are differences
        for field, items in related.items():
            # skip subitem check if it's locked anyway
            if field in obj.locked_fields:
                continue

            # get items from database
            dbitems = list(getattr(obj, field).all())
            dbitems_count = len(dbitems)

            # default to doing nothing
            do_delete = do_update = False

            if items and dbitems_count:         # we have items, so does db, check for conflict
                do_delete = do_update = items_differ(items, dbitems, subfield_dict[field][2])
            elif items and not dbitems_count:   # we have items, db doesn't, just update
                do_update = True
            elif not items and dbitems_count:   # db has items, we don't, just delete
                do_delete = True
            # otherwise: no items or dbitems, so nothing is done

            # don't delete if field is in merge_related
            if field in self.merge_related:
                new_items = []
                # build a list of keyfields to existing database objects
                keylist = self.merge_related[field]
                keyed_dbitems = {tuple(getattr(item, k) for k in keylist):
                                 item for item in dbitems}

                # go through 'new' items
                #   if item with the same keyfields exists:
                #       update the database item w/ the new item's properties
                #   else:
                #       add it to new_items
                for item in items:
                    key = tuple(item.get(k) for k in keylist)
                    dbitem = keyed_dbitems.get(key)
                    if not dbitem:
                        new_items.append(item)
                    else:
                        # update dbitem
                        for fname, val in item.items():
                            setattr(dbitem, fname, val)
                        dbitem.save()

                # import anything that made it to new_items in the usual fashion
                self._create_related(obj, {field: new_items}, subfield_dict)
            else:
                # default logic is to just wipe and recreate subobjects
                if do_delete:
                    updated = True
                    getattr(obj, field).all().delete()
                if do_update:
                    updated = True
                    self._create_related(obj, {field: items}, subfield_dict)

        return updated
115677
def update_entries(entries: Entries, data: dict) -> None:
        """"""
        # TODO: Is mutating the list okay, making copies is such a pain in the ass
        for entry in entries:
            entry.update(data)
1353318
def _update(self, data):
        """"""
        for k, v in six.iteritems(data):
            new_value = v
            if isinstance(v, dict):
                new_value = type(self)(v)
            elif isinstance(v, list):
                new_value = [(type(self)(e) if isinstance(e, dict) else e)
                             for e in v]
            setattr(self, k, new_value)
1337391
def ReleaseProcessedFlow(self, flow_obj):
    """"""
    key = (flow_obj.client_id, flow_obj.flow_id)
    next_id_to_process = flow_obj.next_request_to_process
    request_dict = self.flow_requests.get(key, {})
    if (next_id_to_process in request_dict and
        request_dict[next_id_to_process].needs_processing):
      return False

    self.UpdateFlow(
        flow_obj.client_id,
        flow_obj.flow_id,
        flow_obj=flow_obj,
        processing_on=None,
        processing_since=None,
        processing_deadline=None)
    return True
1157519
def update(self):
        """"""
        for channel in self.channels:
            channel.update()
        for i in range(len(self._project_dict["channels"])):
            channel_dict = self._project_dict["channels"][i]
            for channel in self.channels:
                if channel.name == channel_dict["common.ALLTYPES_NAME"]:
                    self._project_dict["channels"][i] = channel.as_dict()
881798
def update(database, table, key):
    """"""
    field = random.randrange(10)
    value = ''.join(random.choice(string.printable) for i in range(100))
    with database.batch() as batch:
        batch.update(table=table, columns=('id', 'field%d' % field),
                     values=[(key, value)])
38284
def update_many(self, **kwargs):
        
        db_objects = self.get_dbcollection_with_es(**kwargs)
        return self.Model._update_many(
            db_objects, self._json_params, self.request)
1208626
def _update(self):
        """"""
        self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(
            len(self.collection), len(self.header)))
480624
def migrate_flow_collection(apps, schema_editor):
    """"""
    Process = apps.get_model('flow', 'Process')
    DescriptorSchema = apps.get_model('flow', 'DescriptorSchema')

    for process in Process.objects.all():
        process.entity_type = process.flow_collection
        process.entity_descriptor_schema = process.flow_collection

        if (process.entity_descriptor_schema is not None and
                not DescriptorSchema.objects.filter(slug=process.entity_descriptor_schema).exists()):
            raise LookupError(
                "Descriptow schema '{}' referenced in 'entity_descriptor_schema' not "
                "found.".format(process.entity_descriptor_schema)
            )

        process.save()