/* (non-Javadoc)
@see org.parosproxy.paros.db.paros.TableSession#update(long, java.lang.String)
488950
@Override
	public synchronized void update(long sessionId, String sessionName) throws DatabaseException {
        try {
			psUpdate.setLong(2, sessionId);
			psUpdate.setString(1, sessionName);
			psUpdate.executeUpdate();
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
1143830
@Override
    public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
        log.debug("region access strategy nonstrict-read-write entity update() {} {}", getInternalRegion().getCacheNamespace(), key);
        return false;
    }
243129
final void setPSLong(PreparedStatement ps, int index, long value) throws SQLException {
        if (usingDB2Connect || usingSQLServer || usingDB2zOS) { // LIDB2775.25 zOS
            ps.setBigDecimal(index, BigDecimal.valueOf(value));
        } else {
            ps.setLong(index, value);
        }
    }
337477
public T update(T entity) throws RowNotFoundException, OptimisticLockException {

        if (!hasPrimaryKey(entity)) {
            throw new RuntimeException(String.format("Tried to update entity of type %s without a primary key", entity
                    .getClass().getSimpleName()));
        }

        UpdateCreator update = new UpdateCreator(table);

        update.whereEquals(idColumn.getColumnName(), getPrimaryKey(entity));

        if (versionColumn != null) {
            update.set(versionColumn.getColumnName() + " = " + versionColumn.getColumnName() + " + 1");
            update.whereEquals(versionColumn.getColumnName(), getVersion(entity));
        }

        for (Column column : columns) {
            if (!column.isReadOnly()) {
                update.setValue(column.getColumnName(), getFieldValueAsColumn(entity, column));
            }
        }

        int rows = new JdbcTemplate(ormConfig.getDataSource()).update(update);

        if (rows == 1) {

            if (versionColumn != null) {
                ReflectionUtils.setFieldValue(entity, versionColumn.getFieldName(), getVersion(entity) + 1);
            }

            return entity;

        } else if (rows > 1) {

            throw new RuntimeException(
                    String.format("Updating table %s with id %s updated %d rows. There must be a mapping problem. Is column %s really the primary key?",
                            table, getPrimaryKey(entity), rows, idColumn));

        } else {

            //
            // Updated zero rows. This could be because our ID is wrong, or
            // because our object is out-of date. Let's try querying just by ID.
            //

            SelectCreator selectById = new SelectCreator()
            .column("count(*)")
            .from(table)
            .whereEquals(idColumn.getColumnName(), getPrimaryKey(entity));

            rows = new JdbcTemplate(ormConfig.getDataSource()).query(selectById, new ResultSetExtractor<Integer>() {
                @Override
                public Integer extractData(ResultSet rs) throws SQLException, DataAccessException {
                    rs.next();
                    return rs.getInt(1);
                }
            });

            if (rows == 0) {
                throw new RowNotFoundException(table, getPrimaryKey(entity));
            } else {
                throw new OptimisticLockException(table, getPrimaryKey(entity));
            }
        }
    }
863786
public void update(long v) {
    for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
      updateMin(i, v);
    }
  }
267926
public void update(Object feature) throws LayerException {
		Session session = getSessionFactory().getCurrentSession();
		session.update(feature);
	}
953741
@Override
  public <T> Update<T> createUpdate(Class<T> beanType, String ormUpdate) {
    methodCalls.add(MethodCall.of("createUpdate").with("beanType", beanType, "ormUpdate", ormUpdate));
    return delegate.createUpdate(beanType, ormUpdate);
  }
1362538
public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException {
		CompiledStatement compiledStatement = preparedUpdate.compile(databaseConnection, StatementType.UPDATE);
		try {
			int result = compiledStatement.runUpdate();
			if (dao != null && !localIsInBatchMode.get()) {
				dao.notifyChanges();
			}
			return result;
		} finally {
			IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
		}
	}
256510
static int update(Config config, Connection conn, String sql, Object... paras) throws SQLException {
		return MAIN.update(config, conn, sql, paras);
	}
1254867
@Override
    protected void update(List<TableInfo> tableInfos)
    {
        StatementResult result = null;
        String statement = null;
        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                Table table = tableAPI.getTable(tableInfo.getTableName());
                if (table == null)
                {
                    statement = buildCreateDDLQuery(tableInfo);
                    result = tableAPI.executeSync(statement);
                    if (!result.isSuccessful())
                    {
                        throw new SchemaGenerationException("Unable to CREATE TABLE " + tableInfo.getTableName());
                    }
                }
                else
                {
                    List<ColumnInfo> columnInfos = tableInfo.getColumnMetadatas();
                    Map<String, String> newColumns = new HashMap<String, String>();
                    for (ColumnInfo column : columnInfos)
                    {
                        if (table.getField(column.getColumnName()) == null)
                        {
                            newColumns.put(column.getColumnName(), column.getType().getSimpleName());
                        }
                    }

                    List<EmbeddedColumnInfo> embeddedColumnInfos = tableInfo.getEmbeddedColumnMetadatas();
                    for (EmbeddedColumnInfo embeddedColumnInfo : embeddedColumnInfos)
                    {
                        for (ColumnInfo column : embeddedColumnInfo.getColumns())
                        {
                            if (table.getField(column.getColumnName()) == null)
                            {
                                newColumns.put(column.getColumnName(), column.getType().getSimpleName());
                            }
                        }
                    }
                    if (!newColumns.isEmpty())
                    {
                        statement = buildAlterDDLQuery(tableInfo, newColumns);
                        result = tableAPI.executeSync(statement);

                        if (!result.isSuccessful())
                        {
                            throw new SchemaGenerationException("Unable to ALTER TABLE " + tableInfo.getTableName());
                        }
                    }
                }
                createIndexOnTable(tableInfo);
            }
            catch (IllegalArgumentException e)
            {
                logger.error("Invalid Statement. Caused By: ", e);
                throw new SchemaGenerationException(e, "Invalid Statement. Caused By: ");
            }
            catch (FaultException e)
            {
                logger.error("Statement couldn't be executed. Caused By: ", e);
                throw new SchemaGenerationException(e, "Statement couldn't be executed. Caused By: ");
            }
        }
    }
1343521
@Override
  public void update(Result<Integer> result, 
                     int nodeIndex,
                     String sql,
                     Object[] args)
  {
    NodePodAmp node = _podKraken.getNode(nodeIndex);
    
    for (int i = 0; i < node.serverCount(); i++) {
      ServerBartender server = node.server(i);
      
      if (server != null && server.isUp()) {
        ClusterServiceKraken proxy = _podKraken.getProxy(server);
        
        // XXX: failover
        
        proxy.update(result, nodeIndex, sql, args);
        return;
      }
    }

    RuntimeException exn = new ServiceException(L.l("update failed with no live servers"));
    exn.fillInStackTrace();
    
    // XXX: fail
    result.fail(exn);
  }
1276170
@Override
	public void update(Object entity) {
		if (entity == null) {
			throw new IllegalArgumentException("'entity' must not be [" + entity + "]");
		}
		
		if (operation != Log.Operation.GET) {
			throw new IllegalStateException("Log [" + operation + "] -> ["
					+ Log.Operation.UPDATE
					+ "] is not allowed: previous operation must be ["
					+ Log.Operation.GET + "]");
		}
		
		operation = Log.Operation.UPDATE;
	}
1009108
@Override
    protected void update(List<TableInfo> tableInfos)
    {
        if (!clusterManager.hasBucket(databaseName))
        {
            addBucket(databaseName);
            createIdIndex(databaseName);
        }
    }
516106
public int update(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
		try {
			// there is always and id field as an argument so just return 0 lines updated
			if (argFieldTypes.length <= 1) {
				return 0;
			}
			Object[] args = getFieldObjects(data);
			Object newVersion = null;
			if (versionFieldType != null) {
				newVersion = versionFieldType.extractJavaFieldValue(data);
				newVersion = versionFieldType.moveToNextValue(newVersion);
				args[versionFieldTypeIndex] = versionFieldType.convertJavaFieldToSqlArgValue(newVersion);
			}
			int rowC = databaseConnection.update(statement, args, argFieldTypes);
			if (rowC > 0) {
				if (newVersion != null) {
					// if we have updated a row then update the version field in our object to the new value
					versionFieldType.assignField(connectionSource, data, newVersion, false, null);
				}
				if (objectCache != null) {
					// if we've changed something then see if we need to update our cache
					Object id = idField.extractJavaFieldValue(data);
					T cachedData = objectCache.get(clazz, id);
					if (cachedData != null && cachedData != data) {
						// copy each field from the updated data into the cached object
						for (FieldType fieldType : tableInfo.getFieldTypes()) {
							if (fieldType != idField) {
								fieldType.assignField(connectionSource, cachedData,
										fieldType.extractJavaFieldValue(data), false, objectCache);
							}
						}
					}
				}
			}
			logger.debug("update data with statement '{}' and {} args, changed {} rows", statement, args.length, rowC);
			if (args.length > 0) {
				// need to do the (Object) cast to force args to be a single object
				logger.trace("update arguments: {}", (Object) args);
			}
			return rowC;
		} catch (SQLException e) {
			throw SqlExceptionUtil.create("Unable to run update stmt on object " + data + ": " + statement, e);
		}
	}
1258227
public void updateMetadata(String tableName, String metadata){
		try {
			updateStatement.setString(1, metadata);
			updateStatement.setLong(2, tableName.hashCode());
			updateStatement.executeUpdate();
		} catch (SQLException e) {
			throw new BackendException("Could not update metadata for table '" + tableName + "'", e);
		}
	}
713095
public void update(){
        logger.info("Begin automatic schema updating.");
        if(!existsTable()){
            createTable();
        }

        int currentVersion = getCurrentVersion();
        int version = currentVersion;
        String sql = null;

        while((sql = getSql(version + 1)) != null){
            if(sql.trim().length() != 0){
                sqlManager.executeUpdate(new StringSqlResource(sql));
            }
            version++;
        }

        if(version != currentVersion){
            updateVersion(version);
            logger.info(String.format("Schema was updated to version %d.", version));
        } else {
            logger.info("There are no updates.");
        }

        logger.info("End automatic schema updating.");
    }
122143
protected <T> int update (final Table<T> table, final T object,
                              final FieldMask mask)
        throws PersistenceException
    {
        return executeUpdate(new Operation<Integer>() {
            public Integer invoke (Connection conn, DatabaseLiaison liaison)
                throws SQLException, PersistenceException
            {
                return table.update(conn, object, mask);
            }
        });
    }