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 import java.util.Vector ; 31 32 import com.lutris.appserver.server.sql.DBConnection; 33 import com.lutris.appserver.server.sql.Query; 34 import com.lutris.appserver.server.user.User; 35 36 42 class UserSessionsQuery implements Query { 43 44 private User user; 45 46 50 UserSessionsQuery(User user) { 51 this.user = user; 52 } 53 54 60 public ResultSet executeQuery(DBConnection conn) 61 throws SQLException { 62 String sql = "select sessionKey from " 63 + PersistentSessionHome.dbTableName 64 + " where userName = ?"; 65 PreparedStatement stmt = conn.prepareStatement(sql); 66 stmt.setString(1, user.getName()); 67 return conn.executeQuery(stmt, sql); 68 } 69 70 80 public Object next(ResultSet rs) throws SQLException { 81 Vector v = new Vector (); 82 while (rs.next()) { 83 v.addElement(rs.getString("sessionKey")); 84 } 85 return v.elements(); 86 } 87 88 } 89 | Popular Tags |