From 4ce6b7d6e4b7e9583e90bde93bbdece0bcd88262 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 25 Jul 2014 18:38:12 +0700 Subject: getMessageTags --- src/com/juick/server/MessagesQueries.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index fbdd7e69..739bcac1 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -332,6 +332,33 @@ public class MessagesQueries { return user; } + public static ArrayList getMessageTags(Connection sql, int mid) { + ArrayList tags = new ArrayList(); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT tags.tag_id,synonym_id,name,stat_messages FROM tags INNER JOIN messages_tags ON (messages_tags.message_id=? AND messages_tags.tag_id=tags.tag_id)"); + stmt.setInt(1, mid); + rs = stmt.executeQuery(); + rs.beforeFirst(); + while (rs.next()) { + com.juick.Tag t = new com.juick.Tag(); + t.TID = rs.getInt(1); + t.SynonymID = rs.getInt(2); + t.Name = rs.getString(3); + t.UsageCnt = rs.getInt(4); + tags.add(t); + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + + return tags; + } + public static ArrayList getMessageTagsIDs(Connection sql, int mid) { ArrayList tids = new ArrayList(); -- cgit v1.2.3