diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 27 |
1 files changed, 27 insertions, 0 deletions
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<com.juick.Tag> getMessageTags(Connection sql, int mid) { + ArrayList<com.juick.Tag> tags = new ArrayList<com.juick.Tag>(); + + 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<Integer> getMessageTagsIDs(Connection sql, int mid) { ArrayList<Integer> tids = new ArrayList<Integer>(); |