コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public void deleteLegionMember(int playerObjId) {
   PreparedStatement statement = DB.prepareStatement(DELETE_LEGIONMEMBER_QUERY);
   try {
     statement.setInt(1, playerObjId);
   } catch (SQLException e) {
     log.error("Some crap, can't set int parameter to PreparedStatement", e);
   }
   DB.executeUpdateAndClose(statement);
 }
コード例 #2
0
 /** {@inheritDoc} */
 @Override
 public boolean isIdUsed(final int playerObjId) {
   PreparedStatement s =
       DB.prepareStatement(
           "SELECT count(player_id) as cnt FROM legion_members WHERE ? = legion_members.player_id");
   try {
     s.setInt(1, playerObjId);
     ResultSet rs = s.executeQuery();
     rs.next();
     return rs.getInt("cnt") > 0;
   } catch (SQLException e) {
     log.error("Can't check if name " + playerObjId + ", is used, returning possitive result", e);
     return true;
   } finally {
     DB.close(s);
   }
 }