From: Miguel A. B. L. <ari...@us...> - 2006-01-13 16:15:26
|
Update of /cvsroot/arianne/marauroa/src/marauroa/server/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv882/src/marauroa/server/game Modified Files: JDBCPlayerDatabase.java Log Message: Added a method to allow storage of game events in database. Index: JDBCPlayerDatabase.java =================================================================== RCS file: /cvsroot/arianne/marauroa/src/marauroa/server/game/JDBCPlayerDatabase.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** JDBCPlayerDatabase.java 23 Dec 2005 07:29:08 -0000 1.17 --- JDBCPlayerDatabase.java 13 Jan 2006 16:15:17 -0000 1.18 *************** *** 1330,1332 **** --- 1330,1361 ---- } } + + public void addGameEvent(Transaction trans, String source, String event, String... params) throws GenericDatabaseException + { + Log4J.startMethod(logger, "addStatisticsEvent"); + try + { + Connection connection = ((JDBCTransaction)trans).getConnection(); + Statement stmt = connection.createStatement(); + + StringBuffer param=new StringBuffer(); + + for(String i: params) + { + param.append(i); + } + + String query = "insert into gameEvents(timedate, source, event, params) values(NULL,"+source+","+event+","+param.toString()+");"; + stmt.execute(query); + } + catch(SQLException sqle) + { + logger.warn("error adding game event",sqle); + throw new GenericDatabaseException(sqle); + } + finally + { + Log4J.finishMethod(logger, "addStatisticsEvent"); + } + } } |