Validates that all requests have the same table name. Set the table
        name if it is the first request for the batch operation.

        request:
            the request to insert, update or delete entity
352658
def validate_request_table(self, request):
        '''
        
        '''
        if self.batch_table:
            if self.get_request_table(request) != self.batch_table:
                raise AzureBatchValidationError(_ERROR_INCORRECT_TABLE_IN_BATCH)
        else:
            self.batch_table = self.get_request_table(request)
957205
public int update(List<ENTITY> entities) {

        if (entities == null || entities.size() == 0) {
            recordLog(" param entity is null!");
            return 0;
        }

        final List<Query> queries = queryGenerator.getUpdateQuery(entities);
        String sql = queries.get(0).getSql();
        jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {

            public void setValues(PreparedStatement stmt, int index) throws SQLException {
                int i = 1;
                List<Object> params = queries.get(index).getParams();
                for (Object o : params) {
                    stmt.setObject(i++, o);
                }
            }

            public int getBatchSize() {
                return queries.size();
            }
        });

        return entities.size();
    }
636988
def refresh(self, fields=None, **kwargs):
        
        cond = self.c[self._primary_field]==self._key
        query = self.filter(cond, **kwargs)
        if not fields:
            fields = list(self.table.c)
        
        v = query.values_one(*fields)
        if not v:
            raise NotFound('Instance <{0}:{1}> can not be found'.format(self.tablename, self._key))
        
        d = self._data_prepare(v.items())
        self.update(**d)
        self.set_saved()
1254466
def ensure_table(self, cls):
        """"""
        cur = self._conn().cursor()

        table_name = cls.get_table_name()
        index_names = cls.index_names() or []

        cols = ['id text primary key', 'value text']
        for name in index_names:
            cols.append(name + ' text')

        cur.execute('create table if not exists %s (%s)' % (
            table_name,
            ','.join(cols)
        ))

        for name in index_names:
            cur.execute('create index if not exists %s on %s(%s)' % (
                table_name + '_' + name + '_idx',
                table_name,
                name
            ))

        self._conn().commit()
        cur.close()
507958
private void addOrUpdateTable(File file) {
        try {
            String insertStmnt = FileUtils.readFileToString(file);
            DataSource ds = processSql(insertStmnt);
            DataSource existingDs = db().getDataSource(ds.getName());
            if (existingDs == null) {//We never saw this table before.
                db().addDataSource(ds);
                return;
            }
            // If startTime/endTime/templatePath changed then we should update the table.
            if (existingDs.getStartTime() != ds.getStartTime() || 
                    existingDs.getEndTime() != ds.getEndTime() ||
                    !existingDs.getTemplatePath().equals(ds.getTemplatePath())) {
                // We have to reuse the existing entity bean(else update will fail).
                existingDs.updateFrom(ds);
                db().updateDataSource(existingDs);
            }                 
        } catch (IOException ex) {
            log.error("Exception while loading druid sql file {} : {}", file, ex);
        }
    }
1293942
public function setTableName($table)
    {
        if ($this->sql) {
            if ($this->validateToken($table)) {
                $this->table = $table;
                return true;
            } else {
                throw new SimpleCache_Exception("`$table` is not a valid table name");
            }
        }
        return false;
    }
190657
public boolean setDbParamaters(HttpServletRequest request, String provider) {

        return setDbParamaters(request.getParameterMap(), provider, request.getContextPath(), request.getSession());
    }
428540
public function batchUpdate()
    {
        if ($this->_entityName === null) {
            throw new \Exception('Please call « handleEntity(ClassMetadata $class) » before using this handler');
        }
        if (!$this->truncateTable()) {
            throw new \Exception('Could not truncate table ' . $this->getSearchIndexTable());
        }
        $em = $this->_em;
        $indexClass = $this->getSearchIndexClass();

        $batchSize = 100;
        $offset = 0;
        $query = $this->_em->createQueryBuilder()
            ->select('o')
            ->from($this->_entityName, 'o')
            ->setMaxResults($batchSize);

        do {
            $query->setFirstResult($offset);
            $entities = $query->getQuery()->execute();
            foreach ($entities as $entity) {
                $fields = $this->searchIndexes[$this->_class->getName()]['fields'];
                foreach ($fields as $field) {
                    $keywords = $entity->analyseField($field);
                    foreach ($keywords as $keyword) {
                        $index = new $indexClass();
                        $index->setObject($entity);
                        $index->setField($field);
                        $index->setKeyword($keyword);
                        $em->persist($index);
                    }
                }
            }

            $em->flush();
            $offset += $batchSize;
        } while (count($entities) > 0);
    }
1223917
public void putEntity(Entity entity) {
        Assert.isTrue(entity.hasTableName(), "Expecting a table name for the entity: " + entity.getName());
        Assert.isTrue(!hasEntityBySchemaAndTableName(entity.getTable().getSchemaName(), entity.getTable().getName()), "Entity was already added!: " + entity.getTableName());
        currentEntitiesByTableName.put(entity.getTable().getName().toUpperCase(), entity);
        currentEntitiesBySchemaAndTableName.put(entity.getTable().asKeyForMap(), entity);
    }
1268496
private function setFilteredRows(Table $table, Request $request)
    {
        $qb = $table->getQueryBuilder();
        $qbfr = clone $qb;
        $this->addSearch($table, $request, $qbfr);

        $identifiers = $table->getIdentifierFieldNames();

        if (is_null($identifiers)) {
            $paginatorFiltered = new Paginator($qbfr->getQuery());
            $count = $paginatorFiltered->count();
        } else {
            $qbfr->select($qbfr->expr()->count($identifiers));
            $count = (int) $qbfr->getQuery()->getSingleScalarResult();
        }

        $table->setFilteredRows($count);
    }
212077
def _UpdateSessionIfRequired(self, request_headers, response_result, response_headers):    
        

        '''if this request was made with consistency level as session, then update
        the session'''

        if response_result is None or response_headers is None:
            return

        is_session_consistency = False
        if http_constants.HttpHeaders.ConsistencyLevel in request_headers:
            if documents.ConsistencyLevel.Session == request_headers[http_constants.HttpHeaders.ConsistencyLevel]:
                is_session_consistency = True
              
        if is_session_consistency:
            # update session
            self.session.update_session(response_result, response_headers)
739708
def ensure_table(self, cls):
        """"""
        exists = True
        conn = get_conn()

        try:
            descrip = conn.describe_table(cls.get_table_name())
            assert descrip is not None
        except ResourceNotFoundException:
            # Expected - this is what we get if there is no table
            exists = False
        except JSONResponseError:
            # Also assuming no table
            exists = False

        if not exists:
            table = self.table_schema_call(Table.create, cls)
            assert table is not None
1297974
def delete_table(self, tablename, wait=False):
        
        try:
            self.call('delete_table', TableName=tablename)
            if wait:
                self.client.get_waiter('table_not_exists').wait(
                    TableName=tablename
                )
            return True
        except DynamoDBError as e:
            if e.kwargs['Code'] == 'ResourceNotFoundException':
                return False
            else:  # pragma: no cover
                raise
1218099
def set_table(self, schema, **kwargs):
        
        with self.connection(**kwargs) as connection:
            kwargs['connection'] = connection
            if self.has_table(str(schema), **kwargs): return True

            try:
                with self.transaction(**kwargs):
                    self._set_table(schema, **kwargs)

                    for index_name, index in schema.indexes.items():
                        self.set_index(
                            schema,
                            name=index.name,
                            fields=index.fields,
                            connection=connection,
                            **index.options
                        )

            except InterfaceError:
                # check to see if this table now exists, it might have been created
                # in another thread
                if not self.has_table(schema, **kwargs):
                    raise
897727
@Override
    protected void create(List<TableInfo> tableInfos)
    {

        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                if (client.tableExists(tableInfo.getTableName()))
                {
                    client.deleteTable(tableInfo.getTableName());
                }
            }
            catch (Exception e)
            {
                logger.error("Cannot check table existence for table " + tableInfo.getTableName() + ". Caused By: " + e);
                throw new KunderaException("Cannot check table existence for table " + tableInfo.getTableName()
                        + ". Caused By: " + e);
            }
            createKuduTable(tableInfo);
        }
    }
1325543
void processAlterTableRename(Table table) {

        HsqlName name = readNewSchemaObjectName(SchemaObject.TABLE);

        name.setSchemaIfNull(table.getSchemaName());

        if (table.getSchemaName() != name.schema) {
            throw Error.error(ErrorCode.X_42505);
        }

        database.schemaManager.renameSchemaObject(table.getName(), name);
    }
761679
def update_table(self, table, pks=['id']):
        
        if self._check_db() is False:
            return
        try:
            table = self.db[table]
        except Exception as e:
            self.err(e, "Can not find table " + table)
        if self.db is None:
            msg = "Please connect a database before or provide a database url"
            self.err(msg)
            return
        recs = self.to_records_()
        for rec in recs:
            table.insert_ignore(rec, pks, ensure=True)
        self.ok("Data updated in table", table)