1 2 24 25 package com.lutris.appserver.server.sessionEnhydra.persistent; 26 27 import java.sql.PreparedStatement ; 28 import java.sql.ResultSet ; 29 import java.sql.SQLException ; 30 31 import com.lutris.appserver.server.sql.DBConnection; 32 import com.lutris.appserver.server.sql.Query; 33 34 40 class SizeQuery implements Query { 41 42 private String sessionKey; 43 private static final Integer zero = new Integer (0); 44 45 SizeQuery() { 46 } 47 48 54 public ResultSet executeQuery(DBConnection conn) 55 throws SQLException { 56 String sql = "select count (*) totalSessions from " 57 + PersistentSessionHome.dbTableName; 58 PreparedStatement stmt = conn.prepareStatement(sql); 59 return conn.executeQuery(stmt, sql); 60 } 61 62 71 public Object next(ResultSet rs) throws SQLException { 72 if (rs.next()) { 73 return new Integer (rs.getInt("totalSessions")); 74 } 75 return zero; 76 } 77 78 } 79 | Popular Tags |