1 25 26 29 package net.killingar.forum.internal.caches; 30 31 import net.killingar.forum.internal.IDItem; 32 import net.killingar.forum.internal.Poll; 33 34 import java.sql.Connection ; 35 import java.sql.PreparedStatement ; 36 import java.sql.ResultSet ; 37 import java.sql.SQLException ; 38 39 public class PollsCache extends AbstractIDItemCache 40 { 41 public synchronized Poll getPoll(long pollID) throws SQLException 42 { 43 return (Poll)get(pollID); 44 } 45 46 protected IDItem getObjectFromRow(ResultSet result) throws SQLException 47 { 48 return new Poll( 49 result.getLong(1), 50 result.getLong(2), 51 result.getLong(3), 52 result.getString(4), 53 result.getTimestamp(5), 54 result.getTimestamp(6)); 55 } 56 57 protected PreparedStatement createStatement(Connection c) throws SQLException 58 { 59 PreparedStatement statement = c.prepareStatement("select ID, User, UserGroup, Question, Time, LastChanged, from Polls where LastChanged > ?"); 60 61 statement.setTimestamp(1, latestUpdate); 62 63 return statement; 64 } 65 } 66 | Popular Tags |