diff options
author | Ugnich Anton | 2014-07-25 18:38:12 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-07-25 18:38:12 +0700 |
commit | 4ce6b7d6e4b7e9583e90bde93bbdece0bcd88262 (patch) | |
tree | 4043a3dd770880781f6734da97873650cb3902c4 /src/com | |
parent | 13a861563ffead4cadba48e523aad2e5c6beb44c (diff) |
getMessageTags
Diffstat (limited to 'src/com')
-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>(); |