Test
От: anterior_ Россия  
Дата: 19.10.05 10:43
Оценка:
Test.

    public Collection selectMessagesByChannel(long channelId) {
        Collection messages = new ArrayList();
        try {
            Connection conn = DAOFactory.getConnection();
            try {
                PreparedStatement query = conn.prepareStatement(
                        "select ID from jsub_Messages where ChannelID=?");
                query.setLong(1, channelId);
                ResultSet rs = query.executeQuery();
                while(rs.next()) {
                    Message message = findByPrimaryKey(rs.getLong("ID"));
                    messages.add(message);
                }
                rs.close();
                query.close();
            } finally {
                conn.close();
            }
        } catch(Exception e) {
            Log.error("Couldn't select messages by channel \"" + channelId + "\"", e);
        }        
        return messages;
    }
Giving up smoking is the easiest thing in the world. I know because I've done it thousands of times. (c) Mark Twain
Re: Test
От: anterior_ Россия  
Дата: 19.10.05 10:46
Оценка:
Здравствуйте, anterior_, Вы писали:

_>
_>    public Collection selectMessagesByChannel(long channelId) {
_>        Collection messages = new ArrayList();
_>        try {
_>            Connection conn = DAOFactory.getConnection();
_>            try {
_>                PreparedStatement query = conn.prepareStatement(
_>                        "select ID from jsub_Messages where ChannelID=?");
_>                query.setLong(1, channelId);
_>                ResultSet rs = query.executeQuery();
_>                while(rs.next()) {
_>                    Message message = findByPrimaryKey(rs.getLong("ID"));
_>                    messages.add(message);
_>                }
_>                rs.close();
_>                query.close();
_>            } finally {
_>                conn.close();
_>            }
_>        } catch(Exception e) {
_>            Log.error("Couldn't select messages by channel \"" + channelId + "\"", e);
_>        }        
_>        return messages;
_>    }
_>

OK
Giving up smoking is the easiest thing in the world. I know because I've done it thousands of times. (c) Mark Twain
Re[2]: Test
От: MixAnOL  
Дата: 19.10.05 14:14
Оценка:
sasasa
Posted via RSDN NNTP Server 2.0 beta
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.