www.pudn.com > Jsp-Blog.rar > InformationCountDao.java, change:2010-05-25,size:1363b


package myblog.dao; 
 
import java.sql.Connection; 
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.sql.Statement; 
 
import myblog.commons.ConnectionPool; 
 
public class InformationCountDao { 
 
	public Connection conn = null; 
 
	public Statement stmt = null; 
 
	public ResultSet rs = null; 
 
	public int logCount() { 
		int num = 0; 
		conn = ConnectionPool.getConnection(); 
		String sql = "select max(rownum) as maxnum from log"; 
		try { 
			stmt = conn.createStatement(); 
			rs = stmt.executeQuery(sql); 
			rs.next(); 
			num=rs.getInt("maxnum"); 
		} catch (SQLException e) { 
			e.printStackTrace(); 
		} 
 
		return num; 
	} 
	public int reviewCount() { 
		int num = 0; 
		conn = ConnectionPool.getConnection(); 
		String sql = "select max(rownum) as maxnum from review"; 
		try { 
			stmt = conn.createStatement(); 
			rs = stmt.executeQuery(sql); 
			rs.next(); 
			num=rs.getInt("maxnum"); 
		} catch (SQLException e) { 
			e.printStackTrace(); 
		} 
 
		return num; 
	} 
	public int usersCount() { 
		int num = 0; 
		conn = ConnectionPool.getConnection(); 
		String sql = "select max(rownum) as maxnum from users"; 
		try { 
			stmt = conn.createStatement(); 
			rs = stmt.executeQuery(sql); 
			rs.next(); 
			num=rs.getInt("maxnum"); 
		} catch (SQLException e) { 
			e.printStackTrace(); 
		} 
 
		return num; 
	} 
}