Hello Ragezone,
so I was wondering while modifying stuff, does it make sense to save in a boolean wether to update certain DB stuff or not? Can this make my server more stable or is the difference neglegible?
For example:
and:Code:if (updateOmok) { ps = con.prepareStatement("UPDATE minigamestats SET playedomok = ?, omokwins = ?, omokties = ?, omoklosses = ? WHERE accid = ?"); ps.setBoolean(1, playedOmok); ps.setInt(2, OmokStats.get(StatType.WINS)); ps.setInt(3, OmokStats.get(StatType.TIES)); ps.setInt(4, OmokStats.get(StatType.LOSSES)); ps.setInt(5, accid); ps.executeUpdate(); }
I was wondering about this because you wouldn't naturally assume that a player has played omok/matchcards everytime they change channel or log off. So why program it that way?Code:case OMOK: if (playedOmok) { oldStat = OmokStats.get(type); } else { playedOmok = true; } OmokStats.put(type, oldStat + 1); updateOmok = true; break;
Another thing was that I recently read on a forum (MapleRoyals, the server I play) that they recently have lots of issues with lag mainly because of the database. Alot of newer players joined and now there's too many queries happening at once (altough it mainly seems to be merchant-related).
Well anyways, would be nice if someone could give some advice on this.
Edit: Forgot, I naturally also have:
Edit2: Another thing, in connection with this. I've read on some sites (while looking for this) that another problem is not doing rs.close() and ps.close() after accessing the DB. I've noticed that the source (Moople) I'm using is actually missing the close functions in alot of places. So is it a good idea to add these everywhere or is there a reason why it's not used?Code:public void saveMinigameStats(int accid) { if (!updateOmok && !updateCards) return; try { Connection con = DatabaseConnection.getConnection();



Reply With Quote



