From: Hendrik <nh...@us...> - 2009-07-05 21:09:38
|
Update of /cvsroot/arianne/marauroa/src/marauroa/server/db In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18661/src/marauroa/server/db Modified Files: DBTransaction.java Log Message: new method querySingleCellInt Index: DBTransaction.java =================================================================== RCS file: /cvsroot/arianne/marauroa/src/marauroa/server/db/DBTransaction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DBTransaction.java 5 Jul 2009 20:51:14 -0000 1.7 --- DBTransaction.java 5 Jul 2009 21:09:35 -0000 1.8 *************** *** 129,133 **** } - /** * queries the database --- 129,132 ---- *************** *** 140,143 **** --- 139,154 ---- String sql = subst(query, params); return databaseAdapter.query(sql); + } + + /** + * queries the database and returns the first column in the first row as integer (for example for a count(*)). + * + * @param query SQL statement + * @param params parameter values + * @throws SQLException in case of an database error + */ + public int querySingleCellInt(String query, Map<String, Object> params) throws SQLException { + String sql = subst(query, params); + return databaseAdapter.querySingleCellInt(sql); } } |