?? commondao.java
字號:
/*******************************************************************\* ** LightningBoard ** ** http://sourceforge.net/projects/lightningboard/ ** ** Copyright (c) 2002 Xiaobo Liu ** *********************************************************************** LICENSE INFORMATION ** ** LightningBoard is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as ** published by the Free Software Foundation; either version 2 of ** the License, or any later version. ** ** We don't charge anything for the use of LightningBoard, we only ** require you to keep the copyright present on your site and in ** the source files. ** ** LightningBoard is distributed in the hope that it will be useful,** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. See the GNU ** General Public License for more details. ** *\*******************************************************************/package liuxiaobo.lb.dao;import java.sql.*;import java.util.*;import liuxiaobo.db.*;import liuxiaobo.lb.*;import liuxiaobo.lb.bean.*;public class CommonDAO { public synchronized int getTopicID(DBAccess dba) throws SQLException { int i=0; dba.runSql("UPDATE id SET i_number=i_number+1 WHERE i_id=1"); ResultSet rs=dba.openSelect("select i_number from id where i_id=1"); if (rs.next()){ i=rs.getInt(1); } rs.close(); dba.closeSelect(); return i; } public synchronized int getMessageID(DBAccess dba) throws SQLException { int i=0; dba.runSql("UPDATE id SET i_number=i_number+1 WHERE i_id=2"); ResultSet rs=dba.openSelect("select i_number from id where i_id=2"); if (rs.next()){ i=rs.getInt(1); } rs.close(); dba.closeSelect(); return i; } public synchronized int getUserID(DBAccess dba) throws SQLException { int i=0; dba.runSql("UPDATE id SET i_number=i_number+1 WHERE i_id=3"); ResultSet rs=dba.openSelect("select i_number from id where i_id=3"); if (rs.next()){ i=rs.getInt(1); } rs.close(); dba.closeSelect(); return i; } public Map getForumMap(DBAccess dba) throws SQLException { ResultSet rs=dba.openSelect("SELECT f_id,f_name FROM forum"); Map forums=new HashMap(); while(rs.next()){ forums.put(rs.getString("f_id"),rs.getString("f_name")); } rs.close(); dba.closeSelect(); return forums; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -