java批量更新_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > java批量更新

java批量更新

 2013/7/10 15:35:34  xfy142305  程序员俱乐部  我要评论(0)
  • 摘要:publicvoidupdateDoublePoints(finalString[]games,finalString[]servers,finalIntegerstatu){Stringsql="UPDATEdim.dim_game_serverSETis_double_points_game_server=?WHEREgame=?ANDgame_server=?";super.getJdbcTemplate().batchUpdate(sql
  • 标签:Java

public void updateDoublePoints(final String[] games,final String[] servers,final Integer statu) {
?String sql ="UPDATE dim.dim_game_server SET is_double_points_game_server=? WHERE game=? AND game_server = ?";

?super.getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter(){
?
? ?public int getBatchSize(){
? ?return games.length;
? }
? @Override
? public void setValues(java.sql.PreparedStatement ps, int i)
? ? throws SQLException {
? ?ps.setInt(1, statu);
? ?ps.setString(2, games[i]);
? ?ps.setString(3, servers[i]);
? }
?});
}

?

?

?@Override
?public void deleteTableCategory(List<TableCategory> tableCategoryList){
??String sql="DELETE FROM metadata.table_category WHERE db_name=:dbName AND table_category=:tableCategory AND table_name=:tableName";
??SqlParameterSource[] params = SqlParameterSourceUtils.createBatch(tableCategoryList.toArray());
??tableCategoryJdbcTemplate.batchUpdate(sql, params);
?}

发表评论
用户名: 匿名