Example #1
0
  public void updateCastle(L1Castle castle) {
    Connection con = null;
    PreparedStatement pstm = null;
    try {
      con = L1DatabaseFactory.getInstance().getConnection();
      pstm =
          con.prepareStatement(
              "UPDATE castle SET name=?, war_time=?, tax_rate=?, public_money=?, public_ready_money=?, show_money=?, war_basetime=?, security=? WHERE castle_id=?");
      pstm.setString(1, castle.getName());
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
      String fm = sdf.format(castle.getWarTime().getTime());
      //			String fm = DateFormat.getDateTimeInstance().format( //## A1 원본
      //					castle.getWarTime().getTime()); //#
      pstm.setString(2, fm);
      pstm.setInt(3, castle.getTaxRate());
      pstm.setInt(4, castle.getPublicMoney());
      pstm.setInt(5, castle.getPublicReadyMoney());
      pstm.setInt(6, castle.getShowMoney());
      pstm.setInt(7, castle.getWarBaseTime());
      //			String ft = sdf.format(castle.getTimeBase().getTime());
      //			pstm.setString(8, ft);
      pstm.setInt(8, castle.getCastleSecurity());
      pstm.setInt(9, castle.getId());
      pstm.execute();

      _castles.put(castle.getId(), castle);
    } catch (SQLException e) {
      _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
    } finally {
      SQLUtil.close(pstm);
      SQLUtil.close(con);
    }
  }